sumotoy / RA8875

A library for RAiO RA8875 display driver for Teensy3.x or LC/Arduino's/Energia/Spark
GNU General Public License v3.0
80 stars 55 forks source link

Resistive touch "debouncing" #120

Open VintageVolts opened 7 years ago

VintageVolts commented 7 years ago

It seems the resistive touch feature is too quick to respond, or it queues up touch events. I'm using the Adafruit RA8875 board. I am able to detect touch events using the tft.touched() method. After detecting a touch, certain code runs based on the x,y touch position. However, when that code finishes, and it's back to the main loop again, another touch is still buffered... and it responds again!

Is there any way to reset, or clear out the touch buffer (if one even exists) after processing a touch event?

ckim01 commented 6 years ago

Hi Relayer,

I know it's been a year since you posted but I'm just responding because I ran into the same issue and thought it might help others with the same problem. In order to clear the touch buffer I'd do the following:

delay(500); tft.touched(false);

where the delay can be varied to what works best with your code. The delay is there to resolve the race condition so that the touch buffer is always set to 0 before waiting for another touch response. Hope this helps.

-Chris