Closed abdollahpour closed 6 years ago
i am also very interested in this issue
@Bodmer why this lib dont use the T_IRQ pin do detect if the “button” is still pressed? thanks a lot for you great job congratulations very fast lib
The library only provides simple detection capability, more advanced behaviors must be coed in your sketch.
A simple way to implement the behaviour you want is to create a "press" variable that reflects the last detected touch state, then a "press" event is when that variable was false but a touch is detected. So effectively you are making a "change of state" indicator.
Thanks, that's exactly what I'm doing now.
@Franciscopcosta Adding the touch interrupt complicates matters and tends to trigger multiple times, so the approach I have used is to detect and filter the touch events via a simpler polling method.
There are other XPT2046 touch libraries that do use interrupts, so using one of those is an option if this is a "must have" feature.
The code:
returns true with an interval as long as the user keeps the figure on the screen. Is there any way to disable this behavior to create a press event?