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:
79:544eb4964795
Parent:
78:faf49c381591
Child:
81:01da2e34283d
diff -r faf49c381591 -r 544eb4964795 RA8875_Touch.cpp
--- a/RA8875_Touch.cpp	Sun Dec 28 03:14:35 2014 +0000
+++ b/RA8875_Touch.cpp	Sun Dec 28 19:55:16 2014 +0000
@@ -37,7 +37,7 @@
     return noerror;
 }
 
-unsigned char RA8875::TouchPanelRead(loc_t *x, loc_t *y)
+bool RA8875::TouchPanelA2DFiltered(loc_t *x, loc_t *y)
 {
     unsigned char touchready;
     static int xbuf[TPBUFSIZE], ybuf[TPBUFSIZE], sample = 0;
@@ -100,7 +100,7 @@
     return touchready;
 }
 
-unsigned char RA8875::TouchPanelReadRaw(loc_t *x, loc_t *y)
+bool RA8875::TouchPanelA2DRaw(loc_t *x, loc_t *y)
 {
     unsigned char touchready;
 
@@ -366,14 +366,14 @@
  *  operations to scale results by a factor of 2 or even 4.  
  *
  */
-RetCode_t RA8875::TouchPanelPoint(point_t * TouchPoint)
+bool RA8875::TouchPanelReadable(point_t * TouchPoint)
 {
-    RetCode_t retValue = no_touch;
+    bool touched = false;
     point_t screenpoint = {0, 0};
     
-    if (TouchPanelRead(&screenpoint.x, &screenpoint.y)) {
-        retValue = touch;
-        if (tpMatrix.Divider != 0 ) {
+    if (TouchPanelA2DFiltered(&screenpoint.x, &screenpoint.y)) {
+        touched = true;
+        if (tpMatrix.Divider != 0 && TouchPoint) {
             /* Operation order is important since we are doing integer */
             /*  math. Make sure you add all terms together before      */
             /*  dividing, so that the remainder is not rounded off     */
@@ -388,10 +388,10 @@
                               tpMatrix.Fn
                             ) / tpMatrix.Divider ;
         } else {
-            retValue = bad_parameter ;
+            touched = false;
         }
     }
-    return( retValue );
+    return touched;
 }