2020-01-10 11:11 PM
2020-01-10 11:25 PM
After writing the touch screen driver, where to implant the touch screen driver?When simulating IIC, are port pins set in CubeMX?
2020-01-10 11:32 PM
After looking at the official touch screen driver port, it is still unclear where the defined pins are implemented.
2020-01-13 05:43 PM
I would also like to know. I am using an off board touch controller interfaced with I2C to the STM32 MCU. It can use polling to read XY or also trigger an interrupt when XY changes for MCU to read new XY. How would this driver be connected to TouchGFX?
2020-01-13 05:46 PM
I'm very glad to receive your reply, but I haven't made the touch driver yet. I'm sorry that I can't help you.
2020-01-20 02:23 AM
For TouchGFX Touch Controller Drivers you must satisfy the following interface which is called by HAL in every tick:
/**
* @fn virtual bool TouchController::sampleTouch(int32_t& x, int32_t& y) = 0;
*
* @brief Checks whether the touch screen is being touched, and if so, what coordinates.
*
* Checks whether the touch screen is being touched, and if so, what coordinates.
*
* @param [out] x The x position of the touch
* @param [out] y The y position of the touch
*
* @return True if a touch has been detected, otherwise false.
*/
virtual bool sampleTouch(int32_t& x, int32_t& y) = 0;
It usually goes something like this, using your own drivers
Example code:
Finger finger; //only single touch through x and y coords supported
if (touchDetected())
{
//Get sample for finger 1 and extract data
if (getSample(&finger))
{
x = finger.x;
y = finger.y;
return true;
}
}
return false;
Configure the TouchGFX HAL to use this touch controller:
MyTouchController tc;
void touchgfx_init()
{
HAL& hal = touchgfx_generic_init<STM32F7HAL>(dma, display, tc, 480, 272, 0, 0);
...
/Martin