Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Keypad_input_OS2 Keypad_input
Keypad Class Reference
#include <Keypad.h>
Public Member Functions | |
| Keypad (PinName kx, PinName ky, PinName kz, PinName ka, PinName kb, PinName kc, PinName kd) | |
| 4x3 keypad interface: | |
| Keypad (PinName kx, PinName ky, PinName kz, PinName kw, PinName ka, PinName kb, PinName kc, PinName kd) | |
| 4x4 keypad interface: | |
| Keypad (PinName kx, PinName ky, PinName kz, PinName kw, PinName ka, PinName kb, PinName kc, PinName kd, PinName ke) | |
| 5x4 keypad interface: | |
| Keypad (PinName kx, PinName ky, PinName kz, PinName kw, PinName kv, PinName ka, PinName kb, PinName kc, PinName kd, PinName ke) | |
| 5x5 keypad interface: | |
| uint8_t | read (void) |
| Read key data into buffer. | |
| bool | read_state (uint8_t key_num) |
| Read key ON/OFF state. | |
Detailed Description
#include "mbed.h" #include "Keypad.h" // output port X Y Z // Input A * 0 # // Input B 7 8 9 // Input C 4 5 6 // Input D 1 2 3 // X Y Z A B C D OUT(XYZ), IN(ABCD) Keypad key(D10, D9, D8, D7, D6, D5, D4); // define key number at main routine char *const key_table = "?*7410852#963"; // key_table[0]=? is not used! int main() { uint32_t key_num; while(true) { while ((key_num = key.read()) != 0){ printf("%c\r\n", *(key_table + key_num)); } wait(1.0); } }
Definition at line 99 of file Keypad.h.
Constructor & Destructor Documentation
| Keypad | ( | PinName | kx, |
| PinName | ky, | ||
| PinName | kz, | ||
| PinName | ka, | ||
| PinName | kb, | ||
| PinName | kc, | ||
| PinName | kd | ||
| ) |
4x3 keypad interface:
- Parameters:
-
key input port A,B,C,D key output(scan) port X,Y,Z
Definition at line 27 of file Keypad.cpp.
| Keypad | ( | PinName | kx, |
| PinName | ky, | ||
| PinName | kz, | ||
| PinName | kw, | ||
| PinName | ka, | ||
| PinName | kb, | ||
| PinName | kc, | ||
| PinName | kd | ||
| ) |
4x4 keypad interface:
- Parameters:
-
key input port A,B,C,D key output(scan) port X,Y,Z,W
Definition at line 45 of file Keypad.cpp.
| Keypad | ( | PinName | kx, |
| PinName | ky, | ||
| PinName | kz, | ||
| PinName | kw, | ||
| PinName | ka, | ||
| PinName | kb, | ||
| PinName | kc, | ||
| PinName | kd, | ||
| PinName | ke | ||
| ) |
5x4 keypad interface:
- Parameters:
-
key input port A,B,C,D,E key output(scan) port X,Y,Z,W
Definition at line 64 of file Keypad.cpp.
| Keypad | ( | PinName | kx, |
| PinName | ky, | ||
| PinName | kz, | ||
| PinName | kw, | ||
| PinName | kv, | ||
| PinName | ka, | ||
| PinName | kb, | ||
| PinName | kc, | ||
| PinName | kd, | ||
| PinName | ke | ||
| ) |
5x5 keypad interface:
- Parameters:
-
key input port A,B,C,D,E key output(scan) port X,Y,Z,W,V
Definition at line 84 of file Keypad.cpp.
Member Function Documentation
| uint8_t read | ( | void | ) |
Read key data into buffer.
- Parameters:
-
none
- Returns:
- key number by ASCII code
Definition at line 185 of file Keypad.cpp.
| bool read_state | ( | uint8_t | key_num ) |
Read key ON/OFF state.
- Parameters:
-
none
- Returns:
- ON(true) or OFF(false)
Definition at line 190 of file Keypad.cpp.
Generated on Tue Jul 12 2022 11:48:14 by
1.7.2