Hi,
I am having an issue when trying to call TSPoint p = ts.getPoint() from TIMER2 ISR in Arduino UNO.
The code is implementing 5 buttons. Here is the function i am calling from ISR:
bool Touch_getXY(void)
{
TSPoint p = ts.getPoint();
pinMode(YP, OUTPUT); //restore shared pins
pinMode(XM, OUTPUT);
digitalWrite(YP, HIGH); //because TFT control pins
digitalWrite(XM, HIGH);
bool pressed = (p.z > MINPRESSURE && p.z < MAXPRESSURE);
if (pressed) {
//LANDSCAPE
pixel_x = map(p.y, TS_LEFT, TS_RT, 0, tft.width());
pixel_y = map(p.x,TS_BOT , TS_TOP, 0, tft.height());
}
return pressed;
}
The code is inspired from the button example implemented by .kbv.
The interrupt gets called once every second.
Any help is appreciated!
Regards,
Mohammed