-
Notifications
You must be signed in to change notification settings - Fork 56
Keypad
This is the keypad layout, described in terms of CC430 IO pins. When the 7 key is pressed, for example, pin 2.2 will be bridged to 2.3.
2.2 2.1 2.0 1.7
| | | |
2.3----+----+----+----+
| | | |
2.4----+----+----+----+
| | | |
2.5----+----+----+----+
| | | |
2.6----+----+----+----+
| | | |
The keypad has nine pins, but only eight of them seem to be routed. The left most keypad, which matches to pin 2.7, is not used, so this was changed to the buzzer in the GoodWatch20.
Inside of keypad.c
is the PORT2_VECTOR
interrupt handler, which is
responsible for scanning the key matrix when one of the input rows is
pulled high to a column output.
That is to say, we set columns 2.2, 2.1, 2.0 and 1.7 high as output
pins, with rows 2.3, 2.4, 2.5 and 2.6 low as input pins. When one of
the input pins is high, the CPU calls the PORT2_VECTOR
interrupt
handler, which then uses key_row()
and key_col()
to identify which
pins are connected to know which button is being pressed. If this is
different from the previous character, it is passed through
app_keypress()
to the keypress handler for the current applet, so
that the user can react.