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:
68:ab08efabfc88
Parent:
66:468a11f05580
Child:
71:dcac8efd842d
--- a/RA8875.h	Sun Aug 31 14:47:59 2014 +0000
+++ b/RA8875.h	Sun Aug 31 15:52:39 2014 +0000
@@ -8,7 +8,7 @@
 
 // Define this to enable code that monitors the performance of various
 // graphics commands.
-#define PERF_METRICS
+//#define PERF_METRICS
 
 // What better place for some test code than in here and the companion
 // .cpp file. See also the bottom of this file.
@@ -1204,7 +1204,8 @@
     /// than a read can be performed. The frequency set by this API
     /// is for the SPI writes. It will automatically reduce the SPI
     /// clock rate when a read is performed, and restore it for the 
-    /// next write.
+    /// next write. Alternately, the 2nd parameters permits setting
+    /// the read speed rather than letting it compute it automatically.
     ///
     /// @note The primary effect of this is to recover more CPU cycles
     ///     for your application code. Keep in mind that when more than
@@ -1216,9 +1217,11 @@
     ///     range from 1,000,000 (1MHz) to 10,000,000 (10 MHz). Values
     ///     outside this range will be accepted, but operation may
     ///     be unreliable.
+    /// @param Hz2 is an optional parameter and will set the read
+    ///     speed independently of the write speed.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t frequency(unsigned long Hz = RA8875_DEFAULT_SPI_FREQ);
+    RetCode_t frequency(unsigned long Hz = RA8875_DEFAULT_SPI_FREQ, unsigned long Hz2 = 0);
     
 
 #ifdef PERF_METRICS
@@ -1365,6 +1368,17 @@
     ///
     bool _WaitWhileReg(uint8_t reg, uint8_t mask);
 
+    /// set the spi port to either the write or the read speed.
+    ///
+    /// This is a private API used to toggle between the write
+    /// and the read speed for the SPI port to the RA8875, since
+    /// it can accept writes faster than reads.
+    ///
+    /// @param writeSpeed when true selects the write frequency,
+    ///     and when false it selects the read frequency.
+    ///
+    void _setWriteSpeed(bool writeSpeed);
+
     /// The most primitive - to write a data value to the SPI interface.
     ///
     /// @param data is the value to write.
@@ -1384,7 +1398,8 @@
     unsigned char spiread();
     
     SPI spi;                        ///< spi port
-    unsigned long spiwritefreq;          ///< saved write freq
+    bool spiWriteSpeed;             ///< indicates if the current mode is write or read
+    unsigned long spiwritefreq;     ///< saved write freq
     unsigned long spireadfreq;      ///< saved read freq
     DigitalOut cs;                  ///< chip select pin, assumed active low
     DigitalOut res;                 ///< reset pin, assumed active low