LISTWHEEL with resistive touch screen

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • LISTWHEEL with resistive touch screen

      Hi everybody,
      I'm working with an ST STM32F4-DISCOVERY board and I would like to use the listwheel widget in my ui application, but it seems it does not working well with a resistive touch screen, as the one of the demo board.
      In fact, I'm unable to make the listwheel scrolling, it just moves in a strange manner sometimes, when I double touch a point.
      I aslo tried the example WIDGET_Listwheel.c, but it does not work (I know it's not optimized for an embedded application, but I just tried if it's able to follow the touch).
      Has anyone been able to make the Listwheel working with a resistive touch screen?
      Thanks
    • Hi,
      If widgets do not react properly on touch, in most cases this is related to not correctly implemented touch interface.
      The easiest way is to read the touch coordinates from the touch controller (or the convert A/D values) and pass them to emWin.
      I do it like this (in most cases):

      C Source Code

      1. static void PID_X_Exec(void) {
      2. TS_StateTypeDef TS_State;
      3. static GUI_PID_STATE StatePID;
      4. static int IsTouched;
      5. if (_IsInitialized) {
      6. BSP_TS_GetState(&TS_State);
      7. StatePID.Layer = _LayerIndex;
      8. if (TS_State.touchDetected) {
      9. IsTouched = 1;
      10. StatePID.Pressed = 1;
      11. StatePID.x = (int)(TS_State.touchX[0]);
      12. StatePID.y = (int)(TS_State.touchY[0]);
      13. GUI_TOUCH_StoreStateEx(&StatePID);
      14. } else {
      15. if (IsTouched == 1) {
      16. IsTouched = 0;
      17. StatePID.Pressed = 0;
      18. GUI_TOUCH_StoreStateEx(&StatePID);
      19. }
      20. }
      21. }
      22. }
      Display All

      This function can be either called from a dedicated task (like every 25ms) or call it from a super loop if you are not using an RTOS,
      Regards,
      Sven
    • Hi Sven,

      many thanks for your answer, it solved the problem
      Previously, in my PID_Exec() function, I called GUI_TOUCH_StoreStateEx() only if new touch state was different form previous one, therefore only on press/release event: this implies taht on "pressure and move", like when using LISTWHEEL, only the first touch was detected, but nothing else.
      Changed my code according to yours and everything works right.

      Thanks a lot