Skip to main content
DMacD.1
Associate II
April 26, 2022
Question

How to use TouchGFX I2C drivers?

  • April 26, 2022
  • 1 reply
  • 1181 views

Does anyone have an example of how to use TouchGFX's I2C.hpp and I2CTouchController.hpp?

I could not find any in the TouchGFX docs.

My LCD does not have an ST-provided driver, so I am trying to use HAL_I2C_Mem_Read to implement the sampleTouch function.

This topic has been closed for replies.

1 reply

MM..1
Chief III
April 26, 2022

Dont mix sw GUI library with hw control. I2C is simple protocol , you need use it in C or C++ .

Most simple is in main while pool touch IRQ and read store to struct global memory.

And add handle struct

bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
 /**
 * By default sampleTouch returns false,
 * return true if a touch has been detected, otherwise false.
 *
 * Coordinates are passed to the caller by reference by x and y.
 *
 * This function is called by the TouchGFX framework.
 * By default sampleTouch is called every tick, this can be adjusted by HAL::setTouchSampleRate(int8_t);
 *
 */
 return false;
}
 
/* USER CODE END STM32TouchController */
 

DMacD.1
DMacD.1Author
Associate II
April 26, 2022

I can put code other than MX_TouchGFX_Process in the main.c while loop?

I presumed MX_TouchGFX_Process never exited.