A library to control a 4x3 matrix style keypad.
Keypad
A basic library to read in pushbutton presses from the Sparkfun Keypad - 12 Button.
The product site and documentation for the keypad is here. https://www.sparkfun.com/products/8653
Diff: Keypad.h
- Revision:
- 0:fef7520ff0a6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keypad.h Wed Mar 11 14:50:03 2015 +0000 @@ -0,0 +1,33 @@ +#ifndef MBED_SPFUN_KEYPAD_H +#define MBED_SPFUN_KEYPAD_H + +#include "mbed.h" + +class Keypad +{ +private: // private member functions + int getColHit(); + int getRowHit(); + char decode(); + void tristate_all(); + int log2(int num); +public: + + /** Create an ID12 RFID interface, connected to the specified Serial rx port + * + * @param rx Recieve pin + */ + Keypad(PinName row1, PinName row2, PinName row3, PinName row4, PinName col1, PinName col2, PinName col3); + + int getKey(); + int isNewAndPressed(); + +private: + BusInOut rows; + BusInOut cols; + char last_key_hit; + int row_hit; + int col_hit; + +}; +#endif \ No newline at end of file