cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746G-DISCO Touchscreen gestureId issues

BJAUM
Associate

Hi,

I'm working on a project which needs to ​get the gesture of the user on the touchscreen.

Apparently the "BSP_TS_GetState(TS_StateTypeDef *TS_State)" function fills a structure of TS_StateTypeDef type.

typedef struct
{
  uint8_t  touchDetected;
  uint16_t touchX[TS_MAX_NB_TOUCH];
  uint16_t touchY[TS_MAX_NB_TOUCH];
 
#if (TS_MULTI_TOUCH_SUPPORTED == 1)
  uint8_t  touchWeight[TS_MAX_NB_TOUCH];
  uint8_t  touchEventId[TS_MAX_NB_TOUCH];
  uint8_t  touchArea[TS_MAX_NB_TOUCH];
  uint32_t gestureId;
#endif
 
} TS_StateTypeDef;

The ​TS_StateTypeDef contains the gestureId variable which takes the value of type @ref TS_GestureIdTypeDef. (GEST_ID_MOVE_UP, GEST_ID_MOVE_DOWN...)

typedef enum
{
  GEST_ID_NO_GESTURE = 0x00, /*!< Gesture not defined / recognized */
  GEST_ID_MOVE_UP    = 0x01, /*!< Gesture Move Up */
  GEST_ID_MOVE_RIGHT = 0x02, /*!< Gesture Move Right */
  GEST_ID_MOVE_DOWN  = 0x03, /*!< Gesture Move Down */
  GEST_ID_MOVE_LEFT  = 0x04, /*!< Gesture Move Left */
  GEST_ID_ZOOM_IN    = 0x05, /*!< Gesture Zoom In */
  GEST_ID_ZOOM_OUT   = 0x06, /*!< Gesture Zoom Out */
  GEST_ID_NB_MAX     = 0x07  /*!< max number of gesture id */
 
} TS_GestureIdTypeDef;

So in my program i wrote :

//The full code is way more complicated, this part is just the problematic part
TS_StateTypeDef TS_Status; //My structure which will contain all the Touchscreen Datas
char buffer[50];//Text buffer
 
int main(void)
{
  //Fill the TS_Status structure with the Touchscreen datas 
  BSP_TS_GetState(&TS_Status);
 
  //Display on the LCD the TS_Status.gestureId Variable
  sprintf(buffer, "%d", TS_Status.gestureId);
  BSP_LCD_DisplayStringAt(0, LINE(0), &buffer, LEFT_MODE);
}

The problem is that BSP_TS_GetState(&TS_Status) always returns TS_Status.gestureId at 0, even if i move my finger up, down, left...

I already tried with the BSP_TS_Get_GestureId(&TS_State) function, same problem...

Thank you for your help,

Mathieu.

4 REPLIES 4
Amel NASRI
ST Employee

Hi @BJAUM​ ,

Is only the gestureId which is wrong?

What do you get if you want to display touchX and touchY for example?

For the gestureId, you need to call ts_gesture_id_string_tab like what it is already done in STM32Cube_FW_F7_V1.12.0\Projects\STM32F769I-Discovery\Examples\BSP\Src\touchscreen.c:

      /* Get updated gesture Id in global variable 'TS_State' */
      ts_status = BSP_TS_Get_GestureId(&TS_State);
 
      sprintf((char*)lcd_string, "Gesture Id = %s", ts_gesture_id_string_tab[TS_State.gestureId]);
      BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
      BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 15, lcd_string, CENTER_MODE);

Please try this way and let me know if this works for you.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Amel NASRI
ST Employee

I would like to add that ts_gesture_id_string_tab is declared in STM32Cube_FW_F7_V1.12.0\Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery_ts.c as following:

/* Table for touchscreen gesture Id information display on LCD : table indexed on enum @ref TS_GestureIdTypeDef information */
char * ts_gesture_id_string_tab[GEST_ID_NB_MAX] = { "None",
                                                    "Move Up",
                                                    "Move Right",
                                                    "Move Down",
                                                    "Move Left",
                                                    "Zoom In",
                                                    "Zoom Out"
                                                  };
 

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

john doe
Lead

the firmware of the touch screen controller that st used, does not have gestures enabled

MWang.2
Associate

Hi,BJAUM:

Have you fixed this issue, I'm confused about the issue too.