HARDWARE
esp32(not the full pinout one...)
3.5 inch tft screen sheild for arduino uno/mega
specs of screen
|LCD Type:|TFT|
|LCD Interface:|SPI|
|LCD Controller:|ILI9486|
|Touch Screen Type:|Resistive|
|Touch Screen Controller:|XPT2046|
|Colors:|RGB, 65K colors|
|Resolution:|480x320 (Pixel)|
|Aspect Ratio:|8:5|
|I/O Voltage:|3.3V/5V|
Libraries
i am using bodmer's library for showing display in the tft screen in 8bit parallel connection mode
i got the screen working somehow(lack of documentation for using this display with esp32)
then i started tests for touch but bodmer's lib doesnot support resistive touch on parallel connection so i went with the suggested library
(GitHub - s60sc/Adafruit_TouchScreen: Arduino library for 4-wire resistive touchscreens)
i was not able to find how to connect the wires for XP XM YP YM then i found out this library from fork history of the same library
and connected accordingly
|Touch Defines|Display|
|YP|CS|
|XM|RS|
|YM|D1|
|XP|D0|
here is the user defined data for bodmer's library...
*> *
> 02:44:25.654 -> TFT_eSPI ver = 2.5.23
> 02:44:25.654 -> Processor = ESP32
> 02:44:25.654 -> Frequency = 240MHz
> 02:44:25.654 -> Transactions = Yes
> 02:44:25.654 -> Interface = Parallel
> 02:44:25.654 -> Display driver = 9486
> 02:44:25.654 -> Display width = 320
> 02:44:25.654 -> Display height = 480
*> 02:44:25.654 -> *
> 02:44:25.654 -> TFT_CS = GPIO 33
> 02:44:25.654 -> TFT_DC = GPIO 18
> 02:44:25.654 -> TFT_RST = GPIO 32
> 02:44:25.654 -> TFT_WR = GPIO 19
> 02:44:25.701 -> TFT_RD = GPIO 23
*> 02:44:25.701 -> *
> 02:44:25.701 -> TFT_D0 = GPIO 13
> 02:44:25.701 -> TFT_D1 = GPIO 12
> 02:44:25.701 -> TFT_D2 = GPIO 14
> 02:44:25.701 -> TFT_D3 = GPIO 27
> 02:44:25.701 -> TFT_D4 = GPIO 26
> 02:44:25.701 -> TFT_D5 = GPIO 15
> 02:44:25.701 -> TFT_D6 = GPIO 2
> 02:44:25.701 -> TFT_D7 = GPIO 4
*> 02:44:25.701 -> *
> 02:44:25.701 -> Font GLCD loaded
> 02:44:25.701 -> Font 2 loaded
> 02:44:25.701 -> Font 4 loaded
> 02:44:25.701 -> Font 6 loaded
> 02:44:25.701 -> Font 7 loaded
> 02:44:25.701 -> Font 8 loaded
> 02:44:25.701 -> Smooth font enabled
everything is working fine except touch
first of all the pressure is negative
when 0 pressure is applied it return 0 or -1
when force is applied it returns values between -290 and -240
another problem is that X cordinate of the pressure applied never changes its always 4016 and Y cordinate changes as it should from 2800 to 4095
i dont understand this code snippet its in the example of the touch library...
const int coords[] = {4000, 500, 300, 2800};