Getting the touch functionality working with Stemwin?

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

  • Getting the touch functionality working with Stemwin?

    Hi all, I am trying to use the stemwin library on STM32F7 discovery board. I have been able to get it to display what I want, but have not been successful in getting the touch functionality working. The touchis being registered as the x and y values that are passed to the GUI_Touch_StoreStateEx() function change , but the widget/window callback functions is never called.

    I have an interrupt routine for sending the touch state to GUI_Touch_StoreStateEx() function

    Source Code

    1. void EXTI15_10_IRQHandler(void){ GUI_PID_STATE State; if(__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_13) != RESET) { HAL_I2C_Mem_Read(&hi2c3, 0x70, 0x04, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&Temp , 1, 1000); Touch_Y_Pos = (uint16_t) (Temp); HAL_I2C_Mem_Read(&hi2c3, 0x70, 0x03, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&Temp , 1, 1000); Touch_Y_Pos = Touch_Y_Pos | (((uint16_t) (Temp & 0x0F))<<8); Touch_Event = (Temp & 0xC0) >> 6;
    2. HAL_I2C_Mem_Read(&hi2c3, 0x70, 0x06, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&Temp , 1, 1000); Touch_X_Pos = (uint16_t) (Temp); HAL_I2C_Mem_Read(&hi2c3, 0x70, 0x05, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&Temp , 1, 1000); Touch_X_Pos = Touch_X_Pos | (((uint16_t) (Temp & 0x0F))<<8); if (Touch_Event==2) { State.x = Touch_X_Pos; State.y = Touch_Y_Pos; State.Pressed = 1; GUI_TOUCH_StoreStateEx(&State); //HAL_GPIO_TogglePin(GPIOI, GPIO_PIN_1); } else if (Touch_Event ==1) { State.Pressed = 0; State.x = -1; State.y = -1; GUI_TOUCH_StoreStateEx(&State); } __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_13); Touch_Event_Previous = Touch_Event; } }





    Here is the snippet of my main routine that creates a window along with a few widgets, and the callback functions


    Source Code

    1. { Window_1 = WM_CreateWindow(0, 0, 480, 272,WM_CF_SHOW, cbForegroundWin, 0); WM_BringToTop(Window_1); WM_SetFocus(Window_1);
    2. SPINBOX_Delay_in_s = SPINBOX_CreateEx(170, 0, 50, 25, Window_1,WM_CF_SHOW,SPINBOX_Delay_in_s_ID, 0, 10); SPINBOX_Delay_in_us = SPINBOX_CreateEx(170, 25, 75, 25, Window_1,WM_CF_SHOW,SPINBOX_Delay_in_s_ID, 0, 1000000); SPINBOX_Sensitivity = SPINBOX_CreateEx(170, 50, 50, 25, Window_1,WM_CF_SHOW,SPINBOX_Delay_in_s_ID, 0, 100);
    3. BUTTON_Start = BUTTON_CreateEx(166, 245, 70, 35, Window_1, WM_CF_SHOW, 0, BUTTON_Start_ID); WM_SetCallback(BUTTON_Start, BUTTON_Start_Callback); BUTTON_Stop = BUTTON_CreateEx(235, 245, 70, 35, Window_1, WM_CF_SHOW, 0, BUTTON_Stop_ID); BUTTON_SetText(BUTTON_Start, "START"); BUTTON_SetText(BUTTON_Stop, "STOP"); WM_Exec();}


    C Source Code

    1. void cbForegroundWin(WM_MESSAGE * pMsg) { count = count + 1; int Id; int NCode; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetFont(&GUI_Font8x16); GUI_SetColor(GUI_WHITE); GUI_SetTextMode(GUI_TM_NORMAL); GUI_DispStringAt("Delay ( in s ) :", 1, 8); GUI_DispStringAt("Delay ( in us ) :", 1, 35); GUI_DispStringAt("Sensitivity (in %) :", 1, 60); break; case WM_NOTIFY_PARENT: HAL_GPIO_TogglePin(GPIOI, GPIO_PIN_1); Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id){ case BUTTON_Start_ID: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_TOUCH: break; default: break; } } break; default: WM_DefaultProc(pMsg); break; }}
    2. void BUTTON_Start_Callback(WM_MESSAGE * pMsg) { count = count + 1; switch (pMsg->MsgId) { default: BUTTON_Callback(pMsg); break; } }
    Images
    • 1.PNG

      20.7 kB, 968×265, viewed 599 times
    • 2.PNG

      30.18 kB, 749×572, viewed 588 times

    The post was edited 2 times, last by John1992 ().