Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Revision:
178:ae472eb22740
Parent:
166:53fd4a876dac
Child:
181:0032d1b8f5d4
--- a/RA8875_Touch_FT5206.cpp	Wed Jul 17 03:02:31 2019 +0000
+++ b/RA8875_Touch_FT5206.cpp	Sun Jul 28 01:33:02 2019 +0000
@@ -51,9 +51,26 @@
 
 
 RetCode_t RA8875::FT5206_Init() {
-    char data[2] = {FT5206_DEVICE_MODE, 0};
+    const char data[] = {FT5206_DEVICE_MODE, 0};
+    //const char data[] = {0xC3, 0x55, 0x11, 0x33, 0xAA};
 
-    m_i2c->write(m_addr, data, 2);
+    #ifdef DEBUG
+    int count = 0;
+    for (int address=0; address<256; address+=2) {
+        if (!m_i2c->write(address, NULL, 0)) { // 0 returned is ok
+            INFO("I2C address 0x%02X", address);
+            count++;
+        }
+    }
+    INFO("%d devices found", count);
+    #endif
+    
+    INFO("FT5206_Init: Addr %02X", m_addr);
+    HexDump("FT5206 Init", (uint8_t *)data, sizeof(data)/sizeof(data[0]));
+    int err = m_i2c->write(m_addr, data, sizeof(data)/sizeof(data[0]), true);
+    if (err) {
+        ERR("  result: %d", err);
+    }
     return noerror;
 }
 
@@ -61,11 +78,11 @@
     uint8_t valXH;
     uint8_t valYH;
 
-    //INFO("FT5206_TouchPositions()");
+    INFO("FT5206_TouchPositions()");
     numberOfTouchPoints = FT5206_ReadRegU8(FT5206_TD_STATUS) & 0xF;
-    //INFO("  numOfTouchPoints %d", numberOfTouchPoints);
+    INFO("  numOfTouchPoints %d", numberOfTouchPoints);
     gesture = FT5206_ReadRegU8(FT5206_GEST_ID);
-    //INFO("  gesture %d", gesture);
+    INFO("  gesture %d", gesture);
     
     valXH  = FT5206_ReadRegU8(FT5206_TOUCH5_XH);
     valYH  = FT5206_ReadRegU8(FT5206_TOUCH5_YH);