I was working on another project and decided to add a TFT Display. I had a 240x320 TFT laying around so decided to wire it up and Test it on a esp8266.
Code below is ONLY for the Display. Touch is not working. I ran out of Pins on the ESP8266 for the Touch to work. I used Erel's Lib Wrap of the ILI9341, STMPE610, and GFX.
I modified Erel's Lib to Add a RESET Pin to the Init/Constructor. I did this because I read in a post somewhere that Adafruit's docs say you don't need the RESET pin.
However they use it in their code and if you don't have it defined and use a knockoff board it can cause the board to crash. YMMV
My board does not have a STMPE610 Touch Chip. It uses an XPT2046 Touch Chip. So ignore the warning about STMPE610 not used from the compiler.
I am incorporating the display and touch into my current project with an ESP32. I ran out of pins to do it on the ESP8266.
I am working on wrapping the LCDWIKI_Touch Library to use in B4R. I will post that Lib when/if I get it working.
Besides the RESET pin, I think another gotcha for folks may have been that most code I saw says to use D8 (GPIO15) for CS (Chip Select). CS is ACTIVE LOW, PIN D8 has PULLDOWN Resistor tied to it. IMHO that won't work. Use another Pin for CS. This CODE uses the SPI Hardware defined pins. (D5 SCLock GPIO14, D6 MISO GPIO12, D7 MOSI GPIO13).
Another gotcha is I read posts where it says you don't need to have the MISO pin connected. But, you DO if you are using this Library.
SPI usually indicates a 4 wire interface CS, MISO, MOSI, Sclk, this is NOT the same as IIC/I2C which is a two wire interface SCL, and SDA. I read numerous posts on other sites where people use the terms interchangeably and incorrectly, which is why most of THEIR code does not work. YMMV.
Finally the Touch Chip on some TFT boards use STMPE610 or a clone which can be interfaced with SPI or I2C like the above mentioned Lib.
My TFT board uses the Touch Chip XPT2046. This has a completely different interface. It requires a four wire SPI interface and an ADDITIONAL Interrupt Pin. This is why I am wrapping the LCDWIKI_TOUCH Library so I can interface with the XPT2046 and use the Touch Screen.
I am going to post my Working code in the next post. Comments at the end list websites and resources I used to get it working. I will also attached my Lib with my changes to Erel's Wrap.
A long post but I hope some folks find the information provided useful in there projects. Any mistakes I made or critiques of what I said are welcome.
Live Long and Prosper!
Code below is ONLY for the Display. Touch is not working. I ran out of Pins on the ESP8266 for the Touch to work. I used Erel's Lib Wrap of the ILI9341, STMPE610, and GFX.
I modified Erel's Lib to Add a RESET Pin to the Init/Constructor. I did this because I read in a post somewhere that Adafruit's docs say you don't need the RESET pin.
However they use it in their code and if you don't have it defined and use a knockoff board it can cause the board to crash. YMMV
My board does not have a STMPE610 Touch Chip. It uses an XPT2046 Touch Chip. So ignore the warning about STMPE610 not used from the compiler.
I am incorporating the display and touch into my current project with an ESP32. I ran out of pins to do it on the ESP8266.
I am working on wrapping the LCDWIKI_Touch Library to use in B4R. I will post that Lib when/if I get it working.
Besides the RESET pin, I think another gotcha for folks may have been that most code I saw says to use D8 (GPIO15) for CS (Chip Select). CS is ACTIVE LOW, PIN D8 has PULLDOWN Resistor tied to it. IMHO that won't work. Use another Pin for CS. This CODE uses the SPI Hardware defined pins. (D5 SCLock GPIO14, D6 MISO GPIO12, D7 MOSI GPIO13).
Another gotcha is I read posts where it says you don't need to have the MISO pin connected. But, you DO if you are using this Library.
SPI usually indicates a 4 wire interface CS, MISO, MOSI, Sclk, this is NOT the same as IIC/I2C which is a two wire interface SCL, and SDA. I read numerous posts on other sites where people use the terms interchangeably and incorrectly, which is why most of THEIR code does not work. YMMV.
Finally the Touch Chip on some TFT boards use STMPE610 or a clone which can be interfaced with SPI or I2C like the above mentioned Lib.
My TFT board uses the Touch Chip XPT2046. This has a completely different interface. It requires a four wire SPI interface and an ADDITIONAL Interrupt Pin. This is why I am wrapping the LCDWIKI_TOUCH Library so I can interface with the XPT2046 and use the Touch Screen.
I am going to post my Working code in the next post. Comments at the end list websites and resources I used to get it working. I will also attached my Lib with my changes to Erel's Wrap.
A long post but I hope some folks find the information provided useful in there projects. Any mistakes I made or critiques of what I said are welcome.
Live Long and Prosper!
Last edited: