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:
190:3132b7dfad82
Parent:
184:464cc376265d
Child:
193:74f80834d59d
--- a/RA8875_Touch.cpp	Thu Sep 19 21:45:18 2019 +0000
+++ b/RA8875_Touch.cpp	Sat Sep 21 17:30:00 2019 +0000
@@ -49,7 +49,7 @@
 RetCode_t RA8875::TouchPanelInit(void)
 {
     RetCode_t r = noerror;
-    
+
     panelTouched = false;
     if (useTouchPanel == TP_GSL1680) {
         INFO("TouchPanelInit: TP_GSL1680");
@@ -74,7 +74,7 @@
         #else
         touchTicker.attach_us(this, &RA8875::_TouchTicker, TOUCH_TICKER_uS);
         #endif
-        
+
         timeSinceTouch.start();
         timeSinceTouch.reset();
         r = _internal_ts_cal();
@@ -303,7 +303,7 @@
     } else if (useTouchPanel == TP_RES) {
         int a2dX = 0;
         int a2dY = 0;
-        
+
         touchInfo[0].touchID = 0;
         ts = TouchPanelA2DFiltered(&a2dX, &a2dY);
         if (ts != no_touch) {
@@ -345,15 +345,15 @@
     return ts;
 }
 
-uint8_t RA8875::TouchID(uint8_t channel) 
+uint8_t RA8875::TouchID(uint8_t channel)
 {
     if (channel >= TouchChannels())
         channel = 0;
-    return touchInfo[channel].touchID; 
+    return touchInfo[channel].touchID;
 }
 
-TouchCode_t RA8875::TouchCode(uint8_t channel) 
-{ 
+TouchCode_t RA8875::TouchCode(uint8_t channel)
+{
     if (channel >= TouchChannels())
         channel = 0;
     INFO("TouchCode[%d] = %d", channel, touchInfo[channel].touchCode);
@@ -364,7 +364,7 @@
 {
     if (channel >= TouchChannels())
         channel = 0;
-    return TranslateOrientation(touchInfo[channel].coordinates); 
+    return TranslateOrientation(touchInfo[channel].coordinates);
 }
 
 TouchCode_t RA8875::TouchPanelGet(point_t * TouchPoint)
@@ -387,7 +387,7 @@
 point_t RA8875::TranslateOrientation(point_t rawPoint)
 {
     point_t newPoint = rawPoint;
-    
+
     #if 1
     switch (screen_orientation) {
         default:
@@ -595,26 +595,25 @@
 ///   point given a corresponding set of touch screen points:
 ///
 /// <pre>
-///                                             /-     -\
-///             /-    -\     /-            -\   |       |
-///             |      |     |              |   |   Xs  |
-///             |  Xd  |     | A    B    C  |   |       |
-///             |      |  =  |              | * |   Ys  |
-///             |  Yd  |     | D    E    F  |   |       |
-///             |      |     |              |   |   1   |
-///             \-    -/     \-            -/   |       |
-///                                             \-     -/
+///                                             /-     -\    //
+///             /-    -\     /-            -\   |       |    //
+///             |      |     |              |   |   Xs  |    //
+///             |  Xd  |     | A    B    C  |   |       |    //
+///             |      |  =  |              | * |   Ys  |    //
+///             |  Yd  |     | D    E    F  |   |       |    //
+///             |      |     |              |   |   1   |    //
+///             \-    -/     \-            -/   |       |    //
+///                                             \-     -/    //
 ///   where:
 ///          (Xd,Yd) represents the desired display point
 ///                   coordinates,
 ///          (Xs,Ys) represents the available touch screen
 ///                   coordinates, and the matrix
-///          /-   -\
-///          |A,B,C|
-///          |D,E,F| represents the factors used to translate
-///          \-   -/  the available touch screen point values
-///                   into the corresponding display
-///                   coordinates.
+///          /-   -\  represents the factors used to translate
+///          |A,B,C|  the available touch screen point values
+///          |D,E,F|  into the corresponding display
+///          \-   -/  coordinates.
+///
 ///   Note that for practical considerations, the utilities
 ///    within this file do not use the matrix coefficients as
 ///    defined above, but instead use the following
@@ -776,7 +775,7 @@
     FILE * fh;
     tpMatrix_t matrix;
     RetCode_t r = noerror;
-    
+
     if (tpFQFN) {
         fh = fopen(tpFQFN, "rb");
         if (fh) {
@@ -811,7 +810,7 @@
 
 uint8_t RA8875::FT5206_ReadRegU8(uint8_t reg) {
     char val;
-    
+
     m_i2c->write(m_addr, (const char *)&reg, 1);
     m_i2c->read(m_addr, &val, 1);
     //INFO("ReadReg %02X, Val %02X", reg, val);