Class library for a touchscreen-based keypad for the LCD display present on the DISCO_F429ZI board.
Dependents: WIRE-BANDING_FT810 WIRE-BANDING_copy
KEYPAD_DISCO_F429ZI Class Reference
Class library for a touchscreen-based 4x4 keypad for the LCD display present on the DISCO_F429ZI board. More...
#include <KEYPAD_DISCO_F429ZI.h>
Public Member Functions | |
KEYPAD_DISCO_F429ZI () | |
Create a KEYPAD_DISCO_F429ZI object. | |
void | Show (int MessageBoxEnable, int OutBoxEnable) |
Draws the keys for the keypad and the Message Box and Output Box areas if enabled. | |
char | ReadKey () |
Return the current key pressed on the keypad. | |
void | WriteMsgBoxLine (int LineNum, char *text) |
Writes text (21 characters max) to one of the two lines of the Message Box area if it is enabled in Show(). | |
void | WriteOutBox (char *text) |
Writes text (14 characters max) to the Output Box area if it is enabled in Show(). | |
void | SetKeys (char(*keymap)[4]) |
Sets the ASCII characters for each key on the 4x4 keypad. | |
void | SetKeyForeColor (uint32_t color) |
Sets the foreground color for the keypad keys. | |
void | SetKeyBackColor (uint32_t color) |
Sets the background color for the keypad keys. | |
void | SetKeyPressColor (uint32_t color) |
Sets the background color for the keypad keys when it is pressed. | |
void | SetMsgBoxForeColor (uint32_t color) |
Sets the foreground color for the Message Box area. | |
void | SetMsgBoxBackColor (uint32_t color) |
Sets the background color for the Message Box area. | |
void | SetOutBoxForeColor (uint32_t color) |
Sets the foreground color for the Output Box area. | |
void | SetOutBoxBackColor (uint32_t color) |
Sets the background color for the Output Box area. | |
void | SetBackColor (uint32_t color) |
Sets the background color for the whole keypad area. |
Detailed Description
Class library for a touchscreen-based 4x4 keypad for the LCD display present on the DISCO_F429ZI board.
It requires the TS_DISCO_F429ZI and LCD_DISCO_F429ZI to also be imported into the program.
Example:
#include "mbed.h" #include "TS_DISCO_F429ZI.h" #include "LCD_DISCO_F429ZI.h" #include "KEYPAD_DISCO_F429ZI.h" KEYPAD_DISCO_F429ZI keypad; int main() { 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 } } }
Definition at line 67 of file KEYPAD_DISCO_F429ZI.h.
Constructor & Destructor Documentation
Create a KEYPAD_DISCO_F429ZI object.
Definition at line 7 of file KEYPAD_DISCO_F429ZI.cpp.
Member Function Documentation
char ReadKey | ( | ) |
Return the current key pressed on the keypad.
- Parameters:
-
None
- Returns:
- ASCII character of the key pressed. Will be NULL ('/0') if no key is pressed.
Definition at line 105 of file KEYPAD_DISCO_F429ZI.cpp.
void SetBackColor | ( | uint32_t | color ) |
Sets the background color for the whole keypad area.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 334 of file KEYPAD_DISCO_F429ZI.cpp.
void SetKeyBackColor | ( | uint32_t | color ) |
Sets the background color for the keypad keys.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 310 of file KEYPAD_DISCO_F429ZI.cpp.
void SetKeyForeColor | ( | uint32_t | color ) |
Sets the foreground color for the keypad keys.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 306 of file KEYPAD_DISCO_F429ZI.cpp.
void SetKeyPressColor | ( | uint32_t | color ) |
Sets the background color for the keypad keys when it is pressed.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 314 of file KEYPAD_DISCO_F429ZI.cpp.
void SetKeys | ( | char(*) | keymap[4] ) |
Sets the ASCII characters for each key on the 4x4 keypad.
- Parameters:
-
keymap Pointer to a two-dimensional array (array[4][4]) with ASCII characters for each key.
Definition at line 298 of file KEYPAD_DISCO_F429ZI.cpp.
void SetMsgBoxBackColor | ( | uint32_t | color ) |
Sets the background color for the Message Box area.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 322 of file KEYPAD_DISCO_F429ZI.cpp.
void SetMsgBoxForeColor | ( | uint32_t | color ) |
Sets the foreground color for the Message Box area.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 318 of file KEYPAD_DISCO_F429ZI.cpp.
void SetOutBoxBackColor | ( | uint32_t | color ) |
Sets the background color for the Output Box area.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 330 of file KEYPAD_DISCO_F429ZI.cpp.
void SetOutBoxForeColor | ( | uint32_t | color ) |
Sets the foreground color for the Output Box area.
- Parameters:
-
color The color constant or code ARGB(8-8-8-8).
Definition at line 326 of file KEYPAD_DISCO_F429ZI.cpp.
void Show | ( | int | MessageBoxEnable, |
int | OutBoxEnable | ||
) |
Draws the keys for the keypad and the Message Box and Output Box areas if enabled.
- Parameters:
-
MessageBoxEnable Enable (=1) or disable(=0 the drawing of a Message Box area on the keypad screen. OutBoxEnable Enable (=1) or disable(=0 the drawing of a Output Box area on the keypad screen.
Definition at line 39 of file KEYPAD_DISCO_F429ZI.cpp.
void WriteMsgBoxLine | ( | int | LineNum, |
char * | text | ||
) |
Writes text (21 characters max) to one of the two lines of the Message Box area if it is enabled in Show().
- Parameters:
-
LineNum The line number to to where the text must be displayed (0 or 1). text String to display.
Definition at line 278 of file KEYPAD_DISCO_F429ZI.cpp.
void WriteOutBox | ( | char * | text ) |
Writes text (14 characters max) to the Output Box area if it is enabled in Show().
- Parameters:
-
text String to display.
Definition at line 289 of file KEYPAD_DISCO_F429ZI.cpp.
Generated on Sun Jul 24 2022 20:51:54 by 1.7.2