TFT_Touch
TFT_Touch copied to clipboard
TFT 7inch resistive SSD1963 and ESP32 Wroover Dev Kit1
Hi bodmer, i've made some experimentations with my SSD1963 7inch,so i opened this topic because i didn't find anything on the net concerning SSD1963 7 inch with e_SPI and TFT_Touch. I didn't know here to post it os i did here,delete it if you think it's not the place.
Here my sketch to test touch buttons:
//Button test with SSD1963 - 7INCH Resistive & ESP32 Wroover Dev Kit 1
//800x480 in TFT_Touch.cpp : _hres = 800 & _vres = 480
#include <SPI.h> #include <TFT_eSPI.h> TFT_eSPI tft = TFT_eSPI();
// Call up touch screen library #include <TFT_Touch.h>
// These are the pins used to interface between the 2046 touch controller and Arduino Pro #define DOUT 19 /* Data out pin (T_DO) of touch screen / #define DIN 23 / Data in pin (T_DIN) of touch screen / #define DCS 20 / Chip select pin (T_CS) of touch screen / #define DCLK 18 / Clock pin (T_CLK) of touch screen */
/* Create an instance of the touch screen library */ TFT_Touch touch = TFT_Touch(DCS, DCLK, DIN, DOUT);
void setup() { Serial.begin(115200);
tft.init();
// Set the TFT and touch screen to landscape orientation tft.setRotation(1); touch.setRotation(1);
tft.fillScreen(TFT_BLACK);
// TFT H_MAX = 800 & TFT V_MAX = 480 //tft.fillRect(X_MIN, V_MAX - Y_MAX, X_MAX, Y_MAX, COLOR);//Only if Y coarse Inverted in rotation(1) !!
tft.fillRect(400, 240, 400,240, TFT_WHITE);//half screen calibration test
//-------------BUTTONS--------------- tft.fillRect(0, 380, 100, 100, TFT_RED); tft.fillRect(100, 380, 100, 100, TFT_BLUE); tft.fillRect(200, 380, 100, 100, TFT_GREEN); tft.fillRect(300, 380, 100, 100, TFT_YELLOW);
}
void loop() { //int X_RawData; //int Y_RawData; int X_Coord; int Y_Coord; int X_RAW; int Y_RAW;
// Check if the touch screen is currently pressed // Raw and coordinate values are stored within library at this instant // for later retrieval by GetRaw and GetCoord functions.
if (touch.Pressed()) // Note this function updates coordinates stored within library variables { // Read the current X and Y axis as Raw co-ordinates at the last touch time // The values were captured when Pressed() was called!
//Raw coordonates with 800x480 in TFT_Touch.cpp------------
X_RAW = touch.X()- 100;
Y_RAW = 170 - touch.Y()+ 180;//Y coarse inverted corrections
//Remap X & Y Raw datas to fit the TFT resolution
X_Coord = map(X_RAW,0,530,0,800);
Y_Coord = map(Y_RAW,0,220,0,480);
//Debug Raw datas & coordonates in the monitor
Serial.println("X_RAW,Y_RAW :");
Serial.print(X_RAW); Serial.print(","); Serial.println(Y_RAW);
Serial.println("X_Coord,Y_Coord :");
Serial.print(X_Coord); Serial.print(","); Serial.println(Y_Coord);
Serial.println();
//Button test verification on the monitor
if(X_Coord>400 && X_Coord<800 && Y_Coord>25 && Y_Coord<240)
Serial.println("WHITE PRESSED!");
if(X_Coord>35 && X_Coord<135 && Y_Coord>25 && Y_Coord<100)
Serial.println("RED PRESSED!");
if(X_Coord>135 && X_Coord<235 && Y_Coord>25 && Y_Coord<100)
Serial.println("BLUE PRESSED!");
if(X_Coord>235 && X_Coord<335 && Y_Coord>25 && Y_Coord<100)
Serial.println("GREEN PRESSED!");
if(X_Coord>335 && X_Coord<435 && Y_Coord>25 && Y_Coord<100)
Serial.println("YELLOW PRESSED!");
} }
Hello TangerineDreamer, I have a 7inch touch display with SSD1963 and XPT2046 touch driver (probably the same you have). The display is working fine with the Bodmer TFT_eSPI software , however after a lot of test with various touch library, I am unsuccessful. I am using et ESP32S3 dev module Octal (vroom2) with 32MB because I need a lot off memory for my software. For the touch software, my last test is with your soft above with a small change to adapt the pins used for the touch part // These are the pins used to interface between the 2046 touch controller and ESP32S3 #define DOUT 13 // Data out pin (T_DO) of touch screen #define DIN 17 // Data in pin (T_DIN) of touch screen #define DCS 15 // Chip select pin (T_CS) of touch screen #define DCLK 12 // Clock pin (T_CLK) of touch screen When the software is installed, I have all white, yellow, green, blue ans red buttons on the display and when I touch the display nothing on the serial port. If I remove the Dout wire, data are displayed continuously on the serial port (see below) -105,312
X_RAW,Y_RAW : -54,319 X_Coord,Y_Coord : -81,696
X_RAW,Y_RAW : -62,309 X_Coord,Y_Coord : -93,674
X_RAW,Y_RAW : -38,320 X_Coord,Y_Coord : -57,698
X_RAW,Y_RAW : 60,276 X_Coord,Y_Coord : 90,602
with the datascope I can see the Interrupt falling down when the display is touched, but in your sketch and in the tft_touch lib I do not see the usage of the IRQ pin and I do not see how the touch.Pressed() function start.... Could you give me your comments of the above description. regards
hi,papbo, I don't use this display for about 2 years,i use now a buydisplay 4 wires with capacitive touch, it's a dream compared to SSD1963 with resistive touch,and i find capacitive touch is very handy and smooth compared to resistive wich is like a dinausor :) It could be your esp32 s3 is not better for SSD1963+XPT2046 than a regular esp32 ,but i know you need a lot of pins. Have you tried paul stoffregen driver for XPT2046?
https://github.com/PaulStoffregen/XPT2046_Touchscreen
Hi TangerineDreamer, Many thanks for your fast answer. Ok for the buy display 4 wires…. I have tried many libraries for the XPT2046, also the PAUL Stoffregen XPT2046, but it seems that the the union with tft_espi with SSD1963 and XPT2046 is not working well. However the same display with the Utft and URtouch library with a tft shield on a mega 2560 is working (display and touch), but the mega memory is not enough for my software. I will investigate for another display. Regards
Le 16 sept. 2024 à 15:46, TangerineDreamer @.***> a écrit :
hi,papbo, I don't use this display for about 2 years,i use now a buydisplay 4 wires with capacitive touch, it's a dream compared to SSD1963 with resistive touch,and i find capacitive touch is very handy and smooth compared to resistive wich is like a dinausor :) It could be your esp32 s3 is not better for SSD1963+XPT2046 than a regular esp32 ,but i know you need a lot of pins. Have you tried paul stoffregen driver for XPT2046?
https://github.com/PaulStoffregen/XPT2046_Touchscreen
— Reply to this email directly, view it on GitHub https://github.com/Bodmer/TFT_Touch/issues/7#issuecomment-2352971960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZSH3CU7XP3OKHVWEVKIPPLZW3OLPAVCNFSM6AAAAABOIYKXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJSHE3TCOJWGA. You are receiving this because you commented.
I think it's a good decision,4 wires will lead you to every mcu and the libraries work fast, like RA8875 for the display and adafruit Ft6206 for the capacitive touch :)
Ok for all comments Have a nice day Regards