Class library for a touchscreen-based keypad for the LCD display present on the DISCO_F429ZI board.

Dependents:   WIRE-BANDING_FT810 WIRE-BANDING_copy

Files at this revision

API Documentation at this revision

Comitter:
grantphillips
Date:
Tue May 10 21:02:52 2016 +0000
Parent:
3:5f2fa06a0492
Commit message:
v1.0

Changed in this revision

KEYPAD_DISCO_F429ZI.cpp Show annotated file Show diff for this revision Revisions of this file
KEYPAD_DISCO_F429ZI.h Show annotated file Show diff for this revision Revisions of this file
--- a/KEYPAD_DISCO_F429ZI.cpp	Sun May 08 21:11:54 2016 +0000
+++ b/KEYPAD_DISCO_F429ZI.cpp	Tue May 10 21:02:52 2016 +0000
@@ -7,8 +7,8 @@
 KEYPAD_DISCO_F429ZI::KEYPAD_DISCO_F429ZI() {
     LastKey=0;
     ReadKeyState = 0;
-    MsgBColor = LCD_COLOR_YELLOW;
-    MsgFColor = LCD_COLOR_RED;
+    MsgBColor = LCD_COLOR_BLACK;
+    MsgFColor = LCD_COLOR_WHITE;
     OutBColor = LCD_COLOR_WHITE;
     OutFColor = LCD_COLOR_BLACK;
     BackColor = LCD_COLOR_BLACK;
--- a/KEYPAD_DISCO_F429ZI.h	Sun May 08 21:11:54 2016 +0000
+++ b/KEYPAD_DISCO_F429ZI.h	Tue May 10 21:02:52 2016 +0000
@@ -35,13 +35,30 @@
  * Example:
  * @code
  * #include "mbed.h"
- * #include "HCSR04.h"
- *
- * HCSR04 distance(PB_8, PA_1);
- *
+ * #include "TS_DISCO_F429ZI.h"
+ * #include "LCD_DISCO_F429ZI.h"
+ * #include "KEYPAD_DISCO_F429ZI.h"
+ * 
+ * KEYPAD_DISCO_F429ZI keypad;
+ *                            
  * int main() {
- *     while(1){
- *         SWO.printf("Distance = %d (us)   %f (cm)\n", distance.read_us(), distance.read_cm()); 
+ *     char buf[20];
+ *     char k, key;
+ *     
+ *     keypad.Show(1, 1);                              //Display the keypad, enable the Message and Output Box areas
+ *     keypad.WriteMsgBoxLine(0, "Press any key...");  //display a message in the
+ *     keypad.WriteMsgBoxLine(1, "----------------");  //Message Box area of the keypad
+ *    
+ *     while(1) {
+ *         k = keypad.ReadKey();                       //read the current key pressed
+ *         if(k != '\0') {                             //if a key is pressed
+ *             key = k;                                //store the key in a variable
+ *             do                                      //read until key is released
+ *                 k = keypad.ReadKey();
+ *             while(k != '\0');
+ *             sprintf(buf, "%c was pressed", key);    
+ *             keypad.WriteOutBox(buf);                //display result in Output Box area of keypad
+ *         }
  *     }
  * }
  * @endcode
@@ -83,7 +100,7 @@
     
     /** Sets the ASCII characters for each key on the 4x4 keypad.
     * @param 
-    *     keymap Pointer to a two-dimensional array (array[3][3]) with ASCII characters for eahc key.
+    *     keymap Pointer to a two-dimensional array (array[4][4]) with ASCII characters for each key.
     */
     void SetKeys(char (*keymap)[4]);