diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2018-04-11 20:49:32 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2018-04-11 20:49:32 -0400 |
commit | 8e11f269ce352df26af7c44d283131494dcd70fa (patch) | |
tree | be0cbdfb115c0ec9f334b9dd9476d2a59ef3a93a /src/keypad.c | |
parent | 0726b60a6e32760fbadd1cdd39362c9c7a0fd9cc (diff) |
status bar, arrow keys, ins/del
Diffstat (limited to 'src/keypad.c')
-rw-r--r-- | src/keypad.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/keypad.c b/src/keypad.c index 58bc508..b00cf41 100644 --- a/src/keypad.c +++ b/src/keypad.c @@ -55,23 +55,24 @@ static const port_t keypad_cols[COLS] = { #define K_2ND 0x000000FF #define K_HOLD 0x000001FF +#define K_INS 0x000002FF static const char keypad_map[ROWS * COLS * 4] = { - "\x7F\0\0\0" ">\0\0\0" ">=\0\0" "==\0\0" "=\0\0\0" - "x\0\0\0" "<\0\0\0" "<=\0\0" "!=\0\0" "%\0\0\0" - "7\0\0\0" "8\0\0\0" "9\0\0\0" "(\0\0\0" ")\0\0\0" - "4\0\0\0" "5\0\0\0" "6\0\0\0" "/\0\0\0" "*\0\0\0" - "1\0\0\0" "2\0\0\0" "3\0\0\0" "-\0\0\0" "+\0\0\0" - ".\0\0\0" "0\0\0\0" "\xFF\0\0\0" "\b\0\0\0" "\n\0\0\0" + "\x7F\0\0\0" "\xFF\0\0\0" "\xFF\x02\0\0" "\x19\0\0\0" "\x18\0\0\0" + "x\0\0\0" "\0\0\0\0" "\0\0\0\0" "\x1B\0\0\0" "\x1A\0\0\0" + "7\0\0\0" "8\0\0\0" "9\0\0\0" "(\0\0\0" ")\0\0\0" + "4\0\0\0" "5\0\0\0" "6\0\0\0" "/\0\0\0" "*\0\0\0" + "1\0\0\0" "2\0\0\0" "3\0\0\0" "-\0\0\0" "+\0\0\0" + ".\0\0\0" "0\0\0\0" "=\0\0\0" "\b\0\0\0" "\n\0\0\0" }; static const char keypad_map_2nd[ROWS * COLS * 4] = { - "a\0\0\0" "b\0\0\0" "c\0\0\0" "d\0\0\0" "e\0\0\0" - "f\0\0\0" "g\0\0\0" "h\0\0\0" "i\0\0\0" "j\0\0\0" - "k\0\0\0" "l\0\0\0" "m\0\0\0" "n\0\0\0" "o\0\0\0" - "p\0\0\0" "q\0\0\0" "r\0\0\0" "s\0\0\0" "t\0\0\0" - "u\0\0\0" "v\0\0\0" "w\0\0\0" "x\0\0\0" "y\0\0\0" - "z\0\0\0" "\0\0\0\0" "\0\0\0\0" "\x7F\0\0\0" "\xFF\x01\0\0" + "a\0\0\0" "b\0\0\0" "c\0\0\0" "d\0\0\0" "e\0\0\0" + "f\0\0\0" "g\0\0\0" "h\0\0\0" "i\0\0\0" "j\0\0\0" + "k\0\0\0" "l\0\0\0" "m\0\0\0" "n\0\0\0" "o\0\0\0" + "p\0\0\0" "q\0\0\0" "r\0\0\0" "s\0\0\0" "t\0\0\0" + "u\0\0\0" "v\0\0\0" "w\0\0\0" "x\0\0\0" "y\0\0\0" + "z\0\0\0" "\0\0\0\0" "\0\0\0\0" "\0\0\0\0" "\xFF\x01\0\0" }; #define KEY(r, c, i) map[r * COLS * 4 + c * 4 + i] @@ -81,6 +82,8 @@ static const char keypad_map_2nd[ROWS * COLS * 4] = { static char keypad_buffer[BUFFER_SIZE]; static int keypad_buffer_pos = -1; +int keypad_insert = 0; + void keypad_task(void) { unsigned int col = 0; @@ -99,6 +102,8 @@ void keypad_task(void) if ((hold ^= 1) == 0) use2nd = 0; } + } else if (KEYCODE(row, col) == K_INS) { + keypad_insert ^= 1; } else if (keypad_buffer_pos < BUFFER_SIZE) { if (use2nd != 0 && hold == 0) use2nd = 0; |