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:
166:53fd4a876dac
Parent:
165:695c24cc5197
Child:
175:7be3a1fb7fc2
--- a/RA8875.cpp	Sun Feb 24 00:40:00 2019 +0000
+++ b/RA8875.cpp	Sun Feb 24 19:28:26 2019 +0000
@@ -183,6 +183,8 @@
     return bestNdx;
 }
 
+// Non-Touch, or Resistive Touch when later initialized that way
+//
 RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, 
     const char *name)
     : GraphicsDisplay(name)
@@ -191,6 +193,7 @@
     , res(reset)
 {
     useTouchPanel = TP_NONE;
+    touchInfo = NULL;
     tpFQFN = NULL;
     tpCalMessage = NULL;
     m_irq = NULL;
@@ -203,7 +206,8 @@
     fontScaleX = fontScaleY = 1;
 }
 
-
+// Touch, based on FT5206 Controller Chip
+//
 RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, 
     PinName sda, PinName scl, PinName irq, const char * name) 
     : GraphicsDisplay(name)
@@ -217,7 +221,11 @@
     m_i2c = new I2C(sda, scl);
 
     // Cap touch panel config
-    useTouchPanel = TP_FT5206;
+    touchInfo = (touchInfo_T *)malloc(FT5206_TOUCH_POINTS * sizeof(touchInfo_T));
+    if (touchInfo)
+        useTouchPanel = TP_FT5206;
+    else
+        useTouchPanel = TP_NONE;    // unfortnately a silent failure, but unlikely
     m_addr = (FT5206_I2C_ADDRESS << 1);
     m_i2c->frequency(FT5206_I2C_FREQUENCY);
     m_wake = NULL;      // not used for FT5206
@@ -242,6 +250,9 @@
     TouchPanelInit();
 }
 
+
+// Touch, based on GSL1680 Controller Chip
+//
 RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, 
     PinName sda, PinName scl, PinName wake, PinName irq, const char * name) 
     : GraphicsDisplay(name)
@@ -255,7 +266,11 @@
     m_i2c = new I2C(sda, scl);
 
     // Cap touch panel config
-    useTouchPanel = TP_GSL1680;
+    touchInfo = (touchInfo_T *)malloc(FT5206_TOUCH_POINTS * sizeof(touchInfo_T));
+    if (touchInfo)
+        useTouchPanel = TP_GSL1680;
+    else
+        useTouchPanel = TP_NONE;    // unfortnately a silent failure, but unlikely
     m_addr = (GSL1680_I2C_ADDRESS << 1);
     m_i2c->frequency(GSL1680_I2C_FREQUENCY);
     m_wake = new DigitalOut(wake);