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:
41:2956a0a221e5
Parent:
40:04aa280dfa39
Child:
43:3becae133285
--- a/RA8875.h	Tue Feb 04 02:58:06 2014 +0000
+++ b/RA8875.h	Sat Feb 08 17:35:45 2014 +0000
@@ -4,7 +4,7 @@
 
 #include "GraphicsDisplay.h"
 
-#define RA8875_DEFAULT_SPI_FREQ 2000000
+#define RA8875_DEFAULT_SPI_FREQ 5000000
 
 // Define this to enable code that monitors the performance of various
 // graphics commands.
@@ -181,7 +181,7 @@
     ///
     unsigned char ReadCommand(unsigned char command);
     
-    /// Read a data byte to the display
+    /// Read a data byte from the display
     ///
     /// This is a high level command, and may invoke several primitives.
     ///
@@ -189,6 +189,14 @@
     ///
     unsigned char ReadData(void);
     
+    /// Read a word from the display
+    ///
+    /// This is a high level command, and may invoke several primitives.
+    ///
+    /// @returns data that was read.
+    ///
+    uint16_t ReadDataW(void);
+
     /// Read the display status
     ///
     /// This is a high level command, and may invoke several primitives.
@@ -379,6 +387,15 @@
     ///
     virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y);
     
+    /// Prepare the controller to read binary data from the screen by positioning
+    /// the memory read cursor.
+    ///
+    /// @param x is the horizontal position in pixels (from the left edge)
+    /// @param y is the vertical position in pixels (from the top edge)
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    virtual RetCode_t SetGraphicsCursorRead(loc_t x, loc_t y);
+    
     /// Set the window, which controls where items are written to the screen.
     ///
     /// When something hits the window width, it wraps back to the left side
@@ -453,8 +470,8 @@
         
     /// Draw a pixel in the specified color.
     ///
-    /// @note As a side effect, this also sets the foreground  
-    ///     color affecting all subsequent operations.
+    /// @note Unlike many other operations, this does not
+    ///         set the forecolor!
     ///
     /// @param x is the horizontal offset to this pixel.
     /// @param y is the vertical offset to this pixel.
@@ -471,6 +488,34 @@
     ///
     virtual RetCode_t pixel(loc_t x, loc_t y);
     
+    /// Get a pixel from the display.
+    ///
+    /// @param x is the horizontal offset to this pixel.
+    /// @param y is the vertical offset to this pixel.
+    /// @returns the pixel. see @color_t
+    ///
+    virtual color_t getPixel(loc_t x, loc_t y);
+    
+    /// Write a stream of pixels to the display.
+    ///
+    /// @param p is a pointer to a color_t array to write.
+    /// @param count is the number of pixels to write.
+    /// @param x is the horizontal position on the display.
+    /// @param y is the vertical position on the display.
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    virtual RetCode_t pixelStream(color_t * p, uint32_t count, loc_t x, loc_t y);
+    
+    /// Get a stream of pixels from the display.
+    ///
+    /// @param p is a pointer to a color_t array to accept the stream.
+    /// @param count is the number of pixels to read.
+    /// @param x is the horizontal offset to this pixel.
+    /// @param y is the vertical offset to this pixel.
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    virtual RetCode_t getPixelStream(color_t * p, uint32_t count, loc_t x, loc_t y);
+    
     /// Draw a line in the specified color
     ///
     /// @note As a side effect, this changes the current
@@ -827,8 +872,11 @@
     void ClearPerformance();
     
     /// Report the performance metrics for drawing functions using
-    /// printf()
-    void ReportPerformance();
+    /// the available serial channel.
+    ///
+    /// @param pc is the serial channel to write to.
+    ///
+    void ReportPerformance(Serial & pc);
 #endif
 
 private:
@@ -947,7 +995,10 @@
     typedef enum
     {
         PRF_CLS,
-        PRF_DRAWPOINT,
+        PRF_DRAWPIXEL,
+        PRF_PIXELSTREAM,
+        PRF_READPIXEL,
+        PRF_READPIXELSTREAM,
         PRF_DRAWLINE,
         PRF_DRAWRECTANGLE,
         PRF_DRAWROUNDEDRECTANGLE,