2024-08-07 02:25 AM
Hello everyone,
I am using a custom board with a STM32H750VBT6 and TSC2046 Touch Screen Controller with resistive screen.
Unfortunately, I am experiencing some troubles with the swipe gesture due to the nature of resistive screen (sometimes the touch is not detected).
I have tried two methods:
1) Polling Method: TouchGFX's Sampletouch method is called every 20 ms from the LCD IRQ routine when the Back Porch Exit is reached. In Sampletouch method, I communicate with TSC2046 through SPI and I get the raw values for X,Y and Z directions. If Z'value is bigger than a constant threshold, I correct the values of X and Y with a calibration procedure according to Touch Controller's datasheet. Then I set the x and y of sampleTouch method with calibrated values and set a flag to true for SampleTouch's returned value. Otherwise, I simply set to false the flag;
2) Mix between Interrupt and Polling (as suggest in every ST demo project for TouchGFX): In this case I don't evaluate the Z value because I use the PENIRQ of TSC2046 with a EXTI interrupt. So when the IC set to zero PENIRQ (a touch is detected by the controller), my EXTI's callback set a flag to true in order to get the X and Y values in sampleTouch method (sampleTouch method is called every 20ms as case 1).
Can anyone suggest another way or I have to change the resistive screen with capacitive one?