/* first 8 from the first row, then 3 from the second row */
/* keys are 1-9, 0, reset */
-const u8 keymap0[8] = {8, 7, 6, 5, 4, 3, 2, 1};
-const u8 keymap1[3] = {11, 10, 9};
+const u8 keymap0[8] = {KEY_8, KEY_7, KEY_6, KEY_5, KEY_4, KEY_3, KEY_2, KEY_1};
+const u8 keymap1[3] = {KEY_RESET, KEY_0, KEY_9};
-extern inline int keypad_read_row(int row) {
- int i, num;
+extern inline u8 keypad_read_row(u8 row) {
+ u8 i, num;
if (row)
_io_ports[M6811_PORTD] |= PORTD_KEYPAD_ROW;
else
/* returns a key 1..10 or 11 for reset */
void keypad_read() {
/* FIXME: need to do debouncing of some sort? */
- int key;
+ u8 key;
key = keypad_read_row(0);
if (!key) {
key = keypad_read_row(1);
new_key = 0;
return 1;
}
+
+u8 keypad_getkey() {
+ while (!keypad_pressed())
+ keypad_read();
+ return last_key;
+}