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:
165:695c24cc5197
Parent:
164:76edd7d9cb68
Child:
166:53fd4a876dac
--- a/RA8875.cpp	Thu Feb 14 12:34:52 2019 +0000
+++ b/RA8875.cpp	Sun Feb 24 00:40:00 2019 +0000
@@ -195,6 +195,7 @@
     tpCalMessage = NULL;
     m_irq = NULL;
     m_i2c = NULL;
+    m_wake = NULL;
     c_callback = NULL;
     obj_callback = NULL;
     method_callback = NULL;
@@ -210,21 +211,23 @@
     , cs(csel)
     , res(reset)
 {
-    useTouchPanel = TP_CAP;
     tpFQFN = NULL;
     tpCalMessage = NULL;
     m_irq = new InterruptIn(irq);
     m_i2c = new I2C(sda, scl);
+
+    // Cap touch panel config
+    useTouchPanel = TP_FT5206;
+    m_addr = (FT5206_I2C_ADDRESS << 1);
+    m_i2c->frequency(FT5206_I2C_FREQUENCY);
+    m_wake = NULL;      // not used for FT5206
+    
     c_callback = NULL;
     obj_callback = NULL;
     method_callback = NULL;
     idle_callback = NULL;
     fontScaleX = fontScaleY = 1;
 
-    // Cap touch panel config
-    m_addr = (FT5206_I2C_ADDRESS << 1);
-    m_i2c->frequency(FT5206_I2C_FREQUENCY);
-
     // Interrupt
     m_irq->mode(PullUp);
     m_irq->enable_irq();
@@ -239,6 +242,45 @@
     TouchPanelInit();
 }
 
+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)
+    , spi(mosi, miso, sclk)
+    , cs(csel)
+    , res(reset)
+{
+    tpFQFN = NULL;
+    tpCalMessage = NULL;
+    m_irq = new InterruptIn(irq);
+    m_i2c = new I2C(sda, scl);
+
+    // Cap touch panel config
+    useTouchPanel = TP_GSL1680;
+    m_addr = (GSL1680_I2C_ADDRESS << 1);
+    m_i2c->frequency(GSL1680_I2C_FREQUENCY);
+    m_wake = new DigitalOut(wake);
+
+    c_callback = NULL;
+    obj_callback = NULL;
+    method_callback = NULL;
+    idle_callback = NULL;
+    fontScaleX = fontScaleY = 1;
+
+    // Interrupt
+    m_irq->mode(PullUp);
+    m_irq->enable_irq();
+    #if MBED_VERSION >= MBED_ENCODE_VERSION(5,8,0)
+    eventThread.start(callback(&queue, &EventQueue::dispatch_forever));
+    m_irq->fall(queue.event(callback(this, &RA8875::TouchPanelISR)));
+    #elif (MBED_MAJOR_VERSION >= 5) || (MBED_LIBRARY_VERSION > 128)   // Is this the right version?
+    m_irq->fall(callback(this, &RA8875::TouchPanelISR));
+    #else
+    m_irq->fall(this, &RA8875::TouchPanelISR);
+    #endif
+    TouchPanelInit();
+}
+
+
 
 //RA8875::~RA8875()
 //{