acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

Test_Touch_Controller.ino (1335B)

      1 // This sketch is to test the touch controller, nothing is displayed
      2 // on the TFT.  The TFT_eSPI library must be configured to suit your
      3 // pins used. Make sure both the touch chip select and the TFT chip
      4 // select are correctly defined to avoid SPI bus contention.
      5 
      6 // Make sure you have defined a pin for the touch controller chip
      7 // select line in the user setup file or you will see "no member"
      8 // compile errors for the touch functions!
      9 
     10 // It is a support and diagnostic sketch for the TFT_eSPI library:
     11 // https://github.com/Bodmer/TFT_eSPI
     12 
     13 // The "raw" (unprocessed) touch sensor outputs are sent to the
     14 // serial port. Touching the screen should show changes to the x, y
     15 // and z values. x and y are raw ADC readings, not pixel coordinates.
     16 
     17 #include <SPI.h>
     18 #include <TFT_eSPI.h>
     19 TFT_eSPI tft = TFT_eSPI();
     20 
     21 //====================================================================
     22 
     23 void setup(void) {
     24   Serial.begin(115200);
     25   Serial.println("\n\nStarting...");
     26 
     27   tft.init();
     28 }
     29 
     30 //====================================================================
     31 
     32 void loop() {
     33 
     34   uint16_t x, y;
     35 
     36   tft.getTouchRaw(&x, &y);
     37   
     38   Serial.printf("x: %i     ", x);
     39 
     40   Serial.printf("y: %i     ", y);
     41 
     42   Serial.printf("z: %i \n", tft.getTouchRawZ());
     43 
     44   delay(250);
     45 
     46 }
     47 
     48 //====================================================================
     49