cancel
Showing results for 
Search instead for 
Did you mean: 

How to use TouchGFX I2C drivers?

DMacD.1
Associate II

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.

2 REPLIES 2
MM..1
Chief II

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 */
 

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

I presumed MX_TouchGFX_Process never exited.