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:
71:dcac8efd842d
Parent:
68:ab08efabfc88
Child:
72:ecffe56af969
--- a/RA8875.h	Sun Aug 31 15:58:15 2014 +0000
+++ b/RA8875.h	Sat Oct 04 17:45:50 2014 +0000
@@ -343,7 +343,7 @@
     /// @param[inout] y is the y position where the touch was registered.
     /// @returns true if touch was detected, in which case the x and y values were set.
     ///
-    unsigned char TouchPanelRead(loc_t *x, loc_t *y);
+    uint8_t TouchPanelRead(loc_t *x, loc_t *y);
 
     /// Poll the TouchPanel and on a touch event return the raw x, y coordinates.
     ///
@@ -351,7 +351,7 @@
     /// @param[inout] y is the y position where the touch was registered.
     /// @returns true if touch was detected, in which case the x and y values were set.
     ///
-    unsigned char TouchPanelReadRaw(loc_t *x, loc_t *y);
+    uint8_t TouchPanelReadRaw(loc_t *x, loc_t *y);
     
     /// Append interrupt handler for specific RA8875 interrupt source
     ///
@@ -378,6 +378,64 @@
     ///
     void UnAppendISR(uint8_t bISRType);
 
+
+    /// Initialize the keypad interface on the RA8875 controller.
+    ///
+    /// Enables the keypad subsystem. It will scan the 4 x 5 matrix
+    /// and make available key presses. 
+    ///
+    /// @note See section 5-13 of RAIO RA8875 data sheet for more details.
+    /// @caution When using the display from buy-display.com, be sure that
+    ///     the option for the keypad is configured on the hardware.
+    ///
+    /// All parameters are optional.
+    /// @param[in] scanEnable, when true, enables the key scan function (default: true).
+    /// @param[in] longDetect, when true, additionally enables the long key held detection (default: false).
+    /// @param[in] sampleTime setting (range: 0 - 3, default: 0).
+    /// @param[in] scanFrequency setting (range: 0 - 7, default: 0).
+    /// @param[in] longTimeAdjustment (range: 0 - 3, default: 0).
+    /// @param[in] interruptEnable, when true, enables interrupts from keypress (default: false).
+    /// @param[in] wakeupEnable, when true, activates the wakeup function (default: false).
+    ///
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    RetCode_t  KeypadInit(bool scanEnable = true, bool longDetect = false, 
+        uint8_t sampleTime = 0, uint8_t scanFrequency = 0, 
+        uint8_t longTimeAdjustment = 0,
+        bool interruptEnable = false, bool wakeupEnable = false);
+
+    /// Determine if a key has been hit
+    ///
+    /// @returns true if a key has been hit
+    ///
+    bool _kbhit();
+
+    /// Blocking read of the keypad.
+    ///
+    /// @caution: This is a blocking read, so it is important to first call _kbhit()
+    ///         to avoid hanging your processes.
+    ///
+    /// A keypad connected to the RA8875 is connected in a matrix of 4 rows and 5 columns.
+    /// The row where a key is pressed is returned in the lower 2 bits of the upper nibble,
+    /// and the column where a key is pressed is returned in the lower 3 bits of the lower nibble.
+    ///
+    /// Additionally, if configured to detect a "long press", bit 7 will be set to indicate
+    /// this. In this situation, first a "normal press" would be detected and signaled and
+    /// soon after that a "long press" of the same key would be detected and communicated.
+    ///
+    /// Return value encoding: LxRR xCCC
+    /// L = Long Press was detected
+    /// RR = Row number 0 to 3
+    ///
+    /// @return 8-bit value coded as L0RR 0CCC:
+    ///     - L = 1 = Long Press detected
+    ///     - x = 0 = not used
+    ///     - R = 0-3 = Row Number
+    ///     - C = 0-4 = Column Number
+    ///
+    uint8_t _getch();
+
+
     /// Write a command to the display with a word of data.
     ///
     /// This is a high level command, and may invoke several primitives.