Fork without short circuits
Fork of keypad by
No extra hardware is needed besides the wires and switches. The columns are outputs configured with open drain. The rows are inputs configured with pull up resistors. A key press pulls down its row. With scanning the column is determined thereafter.
See SaveKeypad for an example usage.
Diff: keypad.h
- Revision:
- 2:2e4900821a28
- Parent:
- 1:b5eee44fa8a2
- Child:
- 3:ecd4bb97a033
--- a/keypad.h Mon Jan 30 09:48:43 2012 +0000 +++ b/keypad.h Mon Jan 30 09:55:13 2012 +0000 @@ -35,35 +35,34 @@ * user-defined function. User is free to define what to be done with the * input. * - * + * Example: * @code - * -* #include "mbed.h" -* #include "keypad.h" -* -* // Define your own keypad values -* char Keytable[] = { '1', '2', '3', 'A', -* '4', '5', '6', 'B', -* '7', '8', '9', 'C', -* '*', '0', '#', 'D' -* }; -* -* uint32_t cbAfterInput(uint32_t index) { -* printf("Index:%d => Key:%c\n", key, Keytable[index]); -* return 0; -* } -* -* int main() { -* Keypad keypad(p25, p26, p27, p28, p21, p22, p23, p24); -* keypad.CallAfterInput(&cbAfterInput); -* keypad.Start(); -* -* while (1) { -* wait_ms(100); -* } -* } -* @endcode -*/ + * #include "mbed.h" + * #include "keypad.h" + * + * // Define your own keypad values + * char Keytable[] = { '1', '2', '3', 'A', + * '4', '5', '6', 'B', + * '7', '8', '9', 'C', + * '*', '0', '#', 'D' + * }; + * + * uint32_t cbAfterInput(uint32_t index) { + * printf("Index:%d => Key:%c\n", key, Keytable[index]); + * return 0; + * } + * + * int main() { + * Keypad keypad(p25, p26, p27, p28, p21, p22, p23, p24); + * keypad.CallAfterInput(&cbAfterInput); + * keypad.Start(); + * + * while (1) { + * wait_ms(100); + * } + * } + * @endcode + */ class Keypad { public: /** Create a Keypad interface