2020-01-26 06:09 PM
Hello
Touch controllers vary depending on the LCD panel.
It seems that the controller called FT6206 is used in STM32F769I-DISCO.
If I use another controller, do I have to create the driver software from scratch?
What should I refer to?
Thank you.
Solved! Go to Solution.
2020-01-27 12:50 AM
Hi @Ebun.1,
TouchGFX HAL interfaces with touch controllers through the TouchController interface. If you use the generator or start from an AT you will have a file called STM32TouchController.cpp. It contains a method sampleTouch() - Here's an example for the F746G-DISCO TouchController. Simply use your new driver to get the touch coordinates and assign x and y, return true or false depending on "touched" or not.
bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
/* Checking if the screen has been touched */
if (tsDriver)
{
if (tsDriver->DetectTouch(TS_I2C_ADDRESS))
{
/* Get each touch coordinates */
tsDriver->GetXY(TS_I2C_ADDRESS, (uint16_t*)&y, (uint16_t*)&x);
return true;
}
}
return false;
}
Here's the interface class with documentation:
/**
* @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;
2020-01-27 12:50 AM
Hi @Ebun.1,
TouchGFX HAL interfaces with touch controllers through the TouchController interface. If you use the generator or start from an AT you will have a file called STM32TouchController.cpp. It contains a method sampleTouch() - Here's an example for the F746G-DISCO TouchController. Simply use your new driver to get the touch coordinates and assign x and y, return true or false depending on "touched" or not.
bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
/* Checking if the screen has been touched */
if (tsDriver)
{
if (tsDriver->DetectTouch(TS_I2C_ADDRESS))
{
/* Get each touch coordinates */
tsDriver->GetXY(TS_I2C_ADDRESS, (uint16_t*)&y, (uint16_t*)&x);
return true;
}
}
return false;
}
Here's the interface class with documentation:
/**
* @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;
2020-01-27 06:19 AM
If you have a chip that is 'slightly' close to the one that is standard you might get away with modifying the current driver. that should work as long as it's just register addresses and definitions you need to change.
Otherwise - use the approach as written in the other answer - implement your own version of the sampletouch method.
I know it's a bit like apples and oranges. one solution works on the driver level - the other gives you way more freedom to create whatever you want - you could easily make a touchpad that would be translated to screen coordinates or a joystick or something even more silly
2020-01-28 12:06 AM
Thank you for your reply.
I understand.
2020-01-28 12:06 AM
Thank you for your reply.
I understand.