I have 2.8 inch TFT display which uses xpt2406 touchscreen controller, I got the display working but can’t get touch screen to work. Since there is no library for it yet I have tried porting this library https://github.com/spapadim/XPT2046. I changed “Arduino.h” “SPI.h” to “application.h”. But I have no previous experience in porting libraries so I’m not sure what to do next. I saw another post about this library however there was no information about porting except that it should be “easy”. So maybe someone could help me out
I’ve just had a look at the lib and as such I can’t see a big problem (as in the other thread mentioned - and could have linked ).
So, you already started some porting and what is the problem you are seeing now?
Does your altered version build and just not work?
Or does it not build? What errors?
Well it doesn’t build, shows errors on SPI.transfer16() which is at xpt2046.cpp. I tried changing it to just SPI.transfer(), then it compiles but won’t work. Here’s the link for the other thread Touch Screen driver - XPT2046
SPI.transfer16() sends two bytes, so you’d need to have two
SPI.transfer(0); instructions to replace each of the two instances of
SPI.transfer16(0); I could find.
Okay, after some testing I got it to recognize when I touch the screen and print it in the serial monitor. It turns out that something was wrong with my usb ports and serial monitor wasn’t functioning properly. Yesterday I got a new windows update and it fixed the problem. It’s kind of sad that I wasted so much time trying to figure out what was wrong with my code . Thanks for the help anyway .
Hi @Sharas, I’ve tried to port the same code but couldn’t make it play. Any chance you’d post your code so I can run through it and rule that out. (Am using SPI for two slaves, so will double check my slave selects are correct).