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

Keypad.h

Committer:
mitchpang
Date:
2015-03-11
Revision:
0:fef7520ff0a6

File content as of revision 0:fef7520ff0a6:

#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