[Multi touch] GUI_MTOUCH_StoreEvent() causing Hard Fault

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

    • [Multi touch] GUI_MTOUCH_StoreEvent() causing Hard Fault

      Hi Segger Community,

      In my GUI, i'm trying to navigate between windows using gestures.


      • WINDOW 1 => BUTTON PRESS => WINDOW 2 => SWIPE RIGHT (pan gesture) => WINDOW 1

      In my understanding, gestures are managed by the multitouch module.
      Unfortunately there is no informations nor examples on how to implement the function GUI_MTOUCH_StoreEvent()
      My guess is that this function need to be implemented in the same place than the GUI_TOUCH_StoreState(), aka inside the touch controller function.

      but when i call the GUI_MTOUCH_StoreEvent() function, the system goes in hardfault

      here is my code (interruption coming from the touchscreen controller when a touch is detected)
      [C]void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
      {
      GUI_MTOUCH_EVENT pEvent;
      GUI_MTOUCH_INPUT pInput[2];


      if(GPIO_Pin == GPIO_PIN_15) /* if interrupt is from touchscreen */
      {
      touchscreen_get_coordinates(&pEvent.NumPoints,&pInput[0].x,&pInput[0].y,&pInput[1].x,&pInput[1].y);

      pEvent.TimeStamp = GUI_GetTime();

      pInput[0].Id = 0;
      pInput[0].Flags = GUI_MTOUCH_FLAG_DOWN;
      pInput[1].Id = 1;
      pInput[1].Flags = GUI_MTOUCH_FLAG_DOWN;

      GUI_TOUCH_StoreState(pInput[0].x, pInput[0].y);
      GUI_MTOUCH_StoreEvent(&pEvent,pInput);
      }
      }[/C]



      also, GUI_MTOUCH_Enable(1) & WM_GESTURE_Enable(1) are enabled right after GUI_Init()


      i'm using the STemWin lib 5.40 given by STMicroelectronics on a STM32L486 target



      Do you have any example on how to implement this function and use a swipe gesture to navigate trough screens ?




      best regards,


      greffeb
    • Hi,

      I have attached some configurations for different multi touch controller. You can use them as a reference.

      WM_GESTURE_Enable(1) and GUI_MTOUCH_Enable(1) can be called right after GUI_Init(). Depending on your application it can be necessary to switch the gesture support on and of.

      Regards
      Sven
      Files
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      Thank you very much Schoenen,

      i am now able to use the function GUI_MTOUCH_StoreEvent() and run the MTOUCH_ScratchAndGesture.c demo on my board.
      I was missing the whole "create_inputs" handeling

      i also had to add WM_SetCreateFlags(WM_CF_GESTURE); to my code to make my dialogs able to react on gestures;



      I am encounting a new problem now :

      i want to be able to detect a swipe gesture from left to right (using WM_GF_PAN i guess)

      This bit of code is working : i can switch screens using gestures

      C Source Code

      1. case WM_GESTURE:
      2. pGestureInfo = (WM_GESTURE_INFO *)pMsg->Data.p;
      3. switch (pGestureInfo->Flags) {
      4. case WM_GF_PAN:
      5. if(pGestureInfo->Point.x > SWIPE_SENSITIVITY) /* swipe LtoR O----> */
      6. {
      7. WM_HideWindow(pMsg->hWin); /* hide current window */
      8. WM_ShowWindow(hHour_Window);
      9. }
      10. else if(pGestureInfo->Point.x < -SWIPE_SENSITIVITY) /* swipe RtoL <----O */
      11. {
      12. }
      13. WM_InvalidateWindow(pMsg->hWin);
      14. break;
      15. }
      16. break;
      Display All






      But if there is some buttons on my window and i start my gesture on the same position of a button,
      The WM responds to both pan gesture (WM_GF_PAN) and button release (WM_NOTIFICATION_RELEASED) while i only wanted to swipe

      In other words, If i tap on a button and slide my finger outside that button, it is considered as a button release (WM_NOTIFICATION_RELEASED) and not a moved out (WM_NOTIFICATION_MOVED_OUT)



      I tried to add BUTTON_SetReactOnLevel() with no differences

      Is there a way to avoid the button widget sending a WM_NOTIFICATION_RELEASED when a swipe gesture is made from any point of the window (including starting from the button position) ?

      A bit like when you swipe yout finger on your smartphone homescreen it doesn't launch apps but change the page

      Best regards,

      greffeb