keypad library  v1.1.6
Matrix Keypad Library
Functions
keypad.h File Reference

Scans matrix keypad and returns a unique value for each key that is pressed. For an example circuit and program, go to learn.parallax.com and look for a keypad example in the Simple Devices series. More...

#include "simpletools.h"

Go to the source code of this file.

Functions

void keypad_setup (int rowCount, int columnCount, int *rowPinCons, int *columnPinCons, int *buttonValues)
 Set up the row and column dimensions, pins, and key values.
int keypad_read (void)
 Returns the first key pressed, or -1 if no key is pressed.
int keypad_getNumber (void)
 Get a number from the keypad. The number will be retured as soon as a non-numeric key is pressed and released.
int keypad_getNumberEndKey (void)
 Get the key that terminated number received by keypad_getNumber.
int keypad_readFrom (int button)
 If more than one key might be pressed and held at one time, use this keyapd_readFrom function to get the 2nd, 3rd, etc key.

Detailed Description

Scans matrix keypad and returns a unique value for each key that is pressed. For an example circuit and program, go to learn.parallax.com and look for a keypad example in the Simple Devices series.

Author
Andy Lindsay
Version
v1.1.6

Function Documentation

int keypad_getNumber ( void  )

Get a number from the keypad. The number will be retured as soon as a non-numeric key is pressed and released.

Returns
The number that was entered.
int keypad_getNumberEndKey ( void  )

Get the key that terminated number received by keypad_getNumber.

Returns
Key that terminated getNumber.
int keypad_read ( void  )

Returns the first key pressed, or -1 if no key is pressed.

Returns
The value of the key that was pressed. The value for each key is set up in the array that gets passed to keypad_setup's *buttonValues argument.
int keypad_readFrom ( int  button)

If more than one key might be pressed and held at one time, use this keyapd_readFrom function to get the 2nd, 3rd, etc key.

Parameters
buttonPass the value last returned by either keypad_read or keypad_readFrom. This function will start searching from one past that key in the scan order.
Returns
The next key detected in the scan order, or -1 if no additional keys are pressed.
void keypad_setup ( int  rowCount,
int  columnCount,
int *  rowPinCons,
int *  columnPinCons,
int *  buttonValues 
)

Set up the row and column dimensions, pins, and key values.

Parameters
rowCountNumber of keypad rows.
columnCountNumber of keypad columns.
*rowPinConsArray that stores the row connections (from top to bottom).
*columnPinConsArray that stores the column connections (from left to right).
*buttonValuesArray that stores the values that should be returned for each key.