COMATOS KeyPad Driver:
Purpose:
Keypad is a very useful tool for many microcontroller related programs. This
version of COMATOS contains a build-in 16-key keypad driver. With this feature,
the user will no longer need to implement a separate debounce press state machine
and keypad search function inside the program. (This program is still in its
testing phase, there are no guarantees that it is going to work for every program).
Design:
The keypad driver in COMATOS has a debounce press state machine and a keypad mapping functions. Because the debounce press state machine is a real-time operation (detect a button press every 30ms), the easiest way is to use the first task in OS as the debounce press state machine. Once the keypad driver determines the location of the key press, the driver will then determine the key press from a mapping array located in comatos8515.h file and store the value as character in a buffer. All the keys on the keypad serve the same function as the represented symbols except for keys A thru D.
Key A: Enter Key
Key B: No Function
Key C: No Function
Key D: Clear the buffer
1 |
2 |
3 |
A |
4 |
5 |
7 |
B |
7 |
8 |
9 |
C |
* |
9 |
# |
D |
The keypad driver is designed to work for the above keypad scheme
Keypad Function calls:
Out of the seven keypad functions, the user should only use OSKeyPadInit,
OSGetKeyReady, and OSGetKeyCommand; the rest
of the functions are not available to the user. A example
of how to use the keypad driver is given here. A complete listing of the keypad
driver code is located below.
Questions? Contact Nick
Liu