Page 1 of 1

xpt2046

Posted: Fri Jun 28, 2019 5:41 am
by luigibyte
Hi guys.

I am looking for a micropython library to use an XPT2046 touch screen.

I am working on an ESP8266.

I have a tft module that has that touch controller and the pins that I have available are:
TCLK, TCS, TDIN, TD0, TIRQ

thanks in advance :)

Re: xpt2046

Posted: Fri Jun 28, 2019 7:35 am
by pythoncoder
See https://github.com/robert-hh/XPT2046-to ... or-PyBoard from @robert-hh. touch.py is written for the Pyboard and would require some adaptation for different targets.

Re: xpt2046

Posted: Fri Jun 28, 2019 10:23 am
by Roberthh
I made a driver once for PyBoard, and now took your question to adapt & test it on ESP8266. Since it uses SPI for communication, it should be possible to adapt it. You can ignore T_RQ and pull TCS low. Then you need only TCLK = CLK, TDIN = MOSI, and TDO = MISO.
Location: https://github.com/robert-hh/XPT2046-touch-pad-driver
The file for the ESP8266 are xpt2046_syn.py and xpttest as simple test script. It is still relatively large. If that is a problem, it can be tailored small. The minimum is __init__ (some of it), raw_touch() and touch_talk().
@pythoncoder: I'll re-do the asynchronous code. Just for the esp8266 I removed it to keep it as small as possible.