|
|
|
@ -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;
|
|
|
|
|