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:
72:ecffe56af969
Child:
93:6fbc516de05e
--- a/GraphicsDisplay.cpp	Sun Dec 28 03:14:35 2014 +0000
+++ b/GraphicsDisplay.cpp	Sun Dec 28 19:55:16 2014 +0000
@@ -228,9 +228,9 @@
     return noerror;
 }
 
-void GraphicsDisplay::WindowMax(void)
+RetCode_t GraphicsDisplay::WindowMax(void)
 {
-    window(0,0, width(),height());
+    return window(0,0, width(),height());
 }
 
 RetCode_t GraphicsDisplay::_putp(color_t color)
@@ -248,18 +248,17 @@
     return noerror;
 }
 
-void GraphicsDisplay::fill(int x, int y, int w, int h, color_t color)
+RetCode_t GraphicsDisplay::fill(int x, int y, int w, int h, color_t color)
 {
-    fillrect(x,y, x+w, y+h, color);
+    return fillrect(x,y, x+w, y+h, color);
 }
 
 RetCode_t GraphicsDisplay::cls(uint16_t layers)
 {
-    fill(0, 0, width(), height(), _background);
-    return noerror;
+    return fill(0, 0, width(), height(), _background);
 }
 
-void GraphicsDisplay::blit(int x, int y, int w, int h, const int * color)
+RetCode_t GraphicsDisplay::blit(int x, int y, int w, int h, const int * color)
 {
     window(x, y, w, h);
     _StartGraphicsStream();
@@ -267,7 +266,7 @@
         _putp(color[i]);
     }
     _EndGraphicsStream();
-    WindowMax();
+    return WindowMax();
 }
 
 #ifdef LOCALFONT
@@ -384,11 +383,11 @@
 
     PixelHeight = BMP_Info.biHeight;
     PixelWidth = BMP_Info.biWidth;
+    INFO("(%d,%d) (%d,%d) (%d,%d)", x,y, PixelWidth,PixelHeight, width(), height());
     if (PixelHeight > height() + y || PixelWidth > width() + x) {
         fclose(Image);
         return(image_too_big);
     }
-    INFO("(%d,%d) (%d,%d)", x,y, PixelWidth,PixelHeight);
     if (BMP_Info.biBitCount <= 8) {
         int paletteSize;
         // Read the color palette
@@ -448,7 +447,7 @@
         offset = fileOffset + j * (lineBufSize + padd);     // start of line
         fseek(Image, offset, SEEK_SET);
         fread(lineBuffer, 1, lineBufSize, Image);           // read a line - slow !
-        INFO("offset: %6X", offset);
+        //INFO("offset: %6X", offset);
         for (i = 0; i < PixelWidth; i++) {                  // copy pixel data to TFT
             if (BPP_t == 4) {
                 uint8_t dPix = lineBuffer[i/2];
@@ -456,18 +455,14 @@
                     dPix >>= 4;
                 dPix &= 0x0F;
                 pixelBuffer[i] = RGBQuadToRGB16(colorPalette, dPix);
-                //_putp(RGBQuadToRGB16(colorPalette, dPix));
             } else if (BPP_t == 8) {
                 pixelBuffer[i] = RGBQuadToRGB16(colorPalette, lineBuffer[i]);
-                //_putp(RGBQuadToRGB16(colorPalette, lineBuffer[i]));
             } else if (BPP_t == 16) {
                 pixelBuffer[i] = lineBuffer[i];
-                //_putp(lineBuffer[i]);
             } else if (BPP_t == 24) {
                 color_t color;
                 color = RGB(lineBuffer[i*3+2], lineBuffer[i*3+1], lineBuffer[i*3+0]);
                 pixelBuffer[i] = color;
-                //putp(color);
             }
         }
         pixelStream(pixelBuffer, PixelWidth, x, y++);
@@ -566,5 +561,3 @@
 {
     return height() / 8;
 }
-
-