JoaoLopesF / SPFD5408

Adafruit Libraries changed to works in TFT 2.4 shields with the SPFD5408 controller for Arduino Uno and Mega (Discontinued library)
MIT License
154 stars 110 forks source link

TFT rotation and Touch coordinates #6

Closed maitredede closed 5 years ago

maitredede commented 8 years ago

Hi,

When using the paint sample, I can see that screen rotation is not the same that touch rotation : I touch horizontaly (left to right), it draws verticaly (bottom to top). If I tft.setRotation(1), coords are good.

How can I have touch and screen rotation have matching coords ?

Thanks.

JoaoLopesF commented 8 years ago

Hi,

In mine TFTs I need invert the coords. Can be in your case it not necessary.

Please modify the SPFD5408_TouchScreen, line 159:

before:

//return TSPoint(x, y, z);

// *\ SPFD5408 change -- Begin // SPFD5408 change, because Y coordinate is inverted in this controller return TSPoint(x, 1023 - y, z); // -- End

after:

return TSPoint(x, y, z);

// *\ SPFD5408 change -- Begin // SPFD5408 change, because Y coordinate is inverted in this controller //return TSPoint(x, 1023 - y, z); // -- End