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:
124:1690a7ae871c
Parent:
123:2f45e80fec5f
Child:
125:7a0b70f56550
--- a/RA8875.cpp	Mon Jul 25 10:55:58 2016 +0000
+++ b/RA8875.cpp	Sun Jul 31 20:59:01 2016 +0000
@@ -91,18 +91,50 @@
     "not enough ram",         ///< could not allocate ram for scanline
 };
 
-RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char *name)
+RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, 
+    const char *name)
     : GraphicsDisplay(name)
     , spi(mosi, miso, sclk)
     , cs(csel)
     , res(reset)
 {
+    useTouchPanel = TP_NONE;
+    m_irq = NULL;
+    m_i2c = NULL;
     c_callback = NULL;
     obj_callback = NULL;
     method_callback = NULL;
     idle_callback = NULL;
 }
 
+
+RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, 
+    PinName sda, PinName scl, PinName irq, const char * name) 
+    : GraphicsDisplay(name)
+    , spi(mosi, miso, sclk)
+    , cs(csel)
+    , res(reset)
+{
+    useTouchPanel = TP_CAP;
+    m_irq = new InterruptIn(irq);
+    m_i2c = new I2C(sda, scl);
+    c_callback = NULL;
+    obj_callback = NULL;
+    method_callback = NULL;
+    idle_callback = NULL;
+
+    // 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();
+    m_irq->fall(this, &RA8875::TouchPanelISR);
+    TouchPanelInit();
+}
+
+
 //RA8875::~RA8875()
 //{
 //}
@@ -168,8 +200,11 @@
         Backlight_u8(255);
     if (keypadon)
         KeypadInit();
-    if (touchscreenon)
+    if (touchscreenon) {
+        if (useTouchPanel == TP_NONE)
+            useTouchPanel = TP_RES;
         TouchPanelInit();
+    }
 #ifdef PERF_METRICS
     performance.start();
     ClearPerformance();