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:
146:373d59f08357
Parent:
144:ba002c4b21b3
Parent:
145:5eb2492acdda
Child:
147:3494792458d9
--- a/RA8875.cpp	Sat May 06 20:14:48 2017 +0000
+++ b/RA8875.cpp	Thu Jun 01 11:00:40 2017 +0000
@@ -13,6 +13,12 @@
 ///
 #include "RA8875.h"
 
+//#include "Utility.h"            // private memory manager
+#ifndef UTILITY_H
+#define swMalloc malloc         // use the standard
+#define swFree free
+#endif
+
 //#define DEBUG "RAIO"
 // ...
 // INFO("Stuff to show %d", var); // new-line is automatically appended
@@ -135,7 +141,7 @@
     // Interrupt
     m_irq->mode(PullUp);
     m_irq->enable_irq();
-    m_irq->fall(this, &RA8875::TouchPanelISR);
+    m_irq->fall(callback(this, &RA8875::TouchPanelISR));
     TouchPanelInit();
 }
 
@@ -2037,7 +2043,7 @@
 
         // Allocate the memory we need to proceed
         int lineBufSize = ((24 * w + 7)/8);
-        lineBuffer = (uint8_t *)malloc(lineBufSize);
+        lineBuffer = (uint8_t *)swMalloc(lineBufSize);
         if (lineBuffer == NULL) {
             ERR("Not enough RAM for PrintScreen lineBuffer");
             return(not_enough_ram);
@@ -2050,21 +2056,21 @@
         // but is actually causing a failure later. 
         // This test helps determine if it is truly out of memory,
         // or if malloc is broken.
-        pixelBuffer = (color_t *)malloc(2 * w * sizeof(color_t));
+        pixelBuffer = (color_t *)swMalloc(2 * w * sizeof(color_t));
         pixelBuffer2 = pixelBuffer + (w * sizeof(color_t));
         #else
-        pixelBuffer = (color_t *)malloc(w * sizeof(color_t));
-        pixelBuffer2 = (color_t *)malloc(w * sizeof(color_t));
+        pixelBuffer = (color_t *)swMalloc(w * sizeof(color_t));
+        pixelBuffer2 = (color_t *)swMalloc(w * sizeof(color_t));
         #endif
         if (pixelBuffer == NULL || pixelBuffer2 == NULL) {
             ERR("Not enough RAM for pixelBuffer");
             #ifndef DOUBLEBUF
             if (pixelBuffer2)
-                free(pixelBuffer2);
+                swFree(pixelBuffer2);
             #endif
             if (pixelBuffer)
-                free(pixelBuffer);
-            free(lineBuffer);
+                swFree(pixelBuffer);
+            swFree(lineBuffer);
             return(not_enough_ram);
         }
 
@@ -2154,11 +2160,11 @@
         
         #ifndef DOUBLEBUF
         if (pixelBuffer2)
-            free(pixelBuffer2);
+            swFree(pixelBuffer2);
         #endif
         if (pixelBuffer)
-            free(pixelBuffer);
-        free(lineBuffer);
+            swFree(pixelBuffer);
+        swFree(lineBuffer);
         INFO("Image closed");
         return noerror;
     } else {
@@ -2200,7 +2206,7 @@
 
         // Allocate the memory we need to proceed
         int lineBufSize = ((24 * w + 7)/8);
-        lineBuffer = (uint8_t *)malloc(lineBufSize);
+        lineBuffer = (uint8_t *)swMalloc(lineBufSize);
         if (lineBuffer == NULL) {
             ERR("Not enough RAM for PrintScreen lineBuffer");
             return(not_enough_ram);
@@ -2213,21 +2219,21 @@
         // but is actually causing a failure later. 
         // This test helps determine if it is truly out of memory,
         // or if malloc is broken.
-        pixelBuffer = (color_t *)malloc(2 * w * sizeof(color_t));
+        pixelBuffer = (color_t *)swMalloc(2 * w * sizeof(color_t));
         pixelBuffer2 = pixelBuffer + (w * sizeof(color_t));
         #else
-        pixelBuffer = (color_t *)malloc(w * sizeof(color_t));
-        pixelBuffer2 = (color_t *)malloc(w * sizeof(color_t));
+        pixelBuffer = (color_t *)swMalloc(w * sizeof(color_t));
+        pixelBuffer2 = (color_t *)swMalloc(w * sizeof(color_t));
         #endif
         if (pixelBuffer == NULL || pixelBuffer2 == NULL) {
             ERR("Not enough RAM for pixelBuffer");
             #ifndef DOUBLEBUF
             if (pixelBuffer2)
-                free(pixelBuffer2);
+                swFree(pixelBuffer2);
             #endif
             if (pixelBuffer)
-                free(pixelBuffer);
-            free(lineBuffer);
+                swFree(pixelBuffer);
+            swFree(lineBuffer);
             return(not_enough_ram);
         }
 
@@ -2236,11 +2242,11 @@
             ERR("Can't open file for write");
             #ifndef DOUBLEBUF
             if (pixelBuffer2)
-                free(pixelBuffer2);
+                swFree(pixelBuffer2);
             #endif
             if (pixelBuffer)
-                free(pixelBuffer);
-            free(lineBuffer);
+                swFree(pixelBuffer);
+            swFree(lineBuffer);
             return(file_not_found);
         }
 
@@ -2322,11 +2328,11 @@
         fclose(Image);
         #ifndef DOUBLEBUF
         if (pixelBuffer2)
-            free(pixelBuffer2);
+            swFree(pixelBuffer2);
         #endif
         if (pixelBuffer)
-            free(pixelBuffer);
-        free(lineBuffer);
+            swFree(pixelBuffer);
+        swFree(lineBuffer);
         INFO("Image closed");
         return noerror;
     } else {