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)

Files at this revision

API Documentation at this revision

Comitter:
WiredHome
Date:
Sun Mar 19 22:11:04 2017 +0000
Parent:
142:6e9bff59878a
Child:
144:ba002c4b21b3
Commit message:
unbreaking change to SelectDrawingLayer to get the return value as an optional parameter.

Changed in this revision

GraphicsDisplay.h Show annotated file Show diff for this revision Revisions of this file
RA8875.cpp Show annotated file Show diff for this revision Revisions of this file
RA8875.h Show annotated file Show diff for this revision Revisions of this file
--- a/GraphicsDisplay.h	Sun Mar 19 21:41:24 2017 +0000
+++ b/GraphicsDisplay.h	Sun Mar 19 22:11:04 2017 +0000
@@ -170,9 +170,12 @@
     ///
     /// @param[in] layer is 0 or 1 to select the layer for subsequent 
     ///     commands.
-    /// @returns the previous drawing layer; 0 or 1.
+    /// @param[out] prevLayer is an optiona pointer to where the previous layer
+    ///     will be written, making it a little easer to restore layers.
+    ///     Writes 0 or 1 when the pointer is not NULL.
+    /// @returns success/failure code. See @ref RetCode_t.
     ///
-    virtual uint16_t SelectDrawingLayer(uint16_t layer) = 0;
+    virtual RetCode_t SelectDrawingLayer(uint16_t layer, uint16_t * prevLayer = NULL) = 0;
  
     
     /// Get the currently active drawing layer.
@@ -181,7 +184,8 @@
     /// and the currently active drawing layer.
     ///
     /// @code
-    ///     uint16_t prevLayer = lcd.SelectDrawingLayer(x);
+    ///     uint16_t prevLayer;
+    ///     lcd.SelectDrawingLayer(x, &prevLayer);
     ///     lcd.circle(400,25, 25, BrightRed);
     ///     lcd.SelectDrawingLayer(prevLayer);
     /// @endcode
--- a/RA8875.cpp	Sun Mar 19 21:41:24 2017 +0000
+++ b/RA8875.cpp	Sun Mar 19 22:11:04 2017 +0000
@@ -281,10 +281,12 @@
 }
 
 
-uint16_t RA8875::SelectDrawingLayer(uint16_t layer)
+RetCode_t RA8875::SelectDrawingLayer(uint16_t layer, uint16_t * prevLayer)
 {
     unsigned char mwcr1 = ReadCommand(0x41); // retain all but the currently selected layer
-    uint16_t prevlayer = mwcr1 & 1;
+    
+    if (prevLayer)
+        *prevLayer = mwcr1 & 1;
     
     mwcr1 &= ~0x01; // remove the current layer
     if (screenwidth >= 800 && screenheight >= 480 && screenbpp > 8) {
@@ -292,8 +294,7 @@
     } else if (layer > 1) {
         layer = 0;
     }
-    WriteCommand(0x41, mwcr1 | layer);
-    return prevlayer;
+    return WriteCommand(0x41, mwcr1 | layer);
 }
 
 
--- a/RA8875.h	Sun Mar 19 21:41:24 2017 +0000
+++ b/RA8875.h	Sun Mar 19 22:11:04 2017 +0000
@@ -564,9 +564,12 @@
     ///
     /// @param[in] layer is 0 or 1 to select the layer for subsequent 
     ///     commands.
-    /// @returns the previous drawing layer; 0 or 1.
-    ///
-    virtual uint16_t SelectDrawingLayer(uint16_t layer);
+    /// @param[out] prevLayer is an optiona pointer to where the previous layer
+    ///     will be written, making it a little easer to restore layers.
+    ///     Writes 0 or 1 when the pointer is not NULL.
+    /// @returns success/failure code. See @ref RetCode_t.
+    ///
+    virtual RetCode_t SelectDrawingLayer(uint16_t layer, uint16_t * prevLayer = NULL);
  
     
     /// Get the currently active drawing layer.