From: Alan Cox Date: Sat, 17 Nov 2018 10:55:14 +0000 (+0000) Subject: sam: turn on keyboard masks, repeat and keymap reloading X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a2810b479e6bde162b31a8eb29e7274f87f63035;p=FUZIX.git sam: turn on keyboard masks, repeat and keymap reloading Keyboard is not quite usable. Only known problem is the control key seems to be broken at this point --- diff --git a/Kernel/platform-sam/devtty.c b/Kernel/platform-sam/devtty.c index 15580a72..b59cf069 100644 --- a/Kernel/platform-sam/devtty.c +++ b/Kernel/platform-sam/devtty.c @@ -7,8 +7,10 @@ #include #include -char tbuf1[TTYSIZ]; -char tbuf2[TTYSIZ]; +static char tbuf1[TTYSIZ]; +static char tbuf2[TTYSIZ]; + +struct vt_repeat keyrepeat = { 50, 5 }; struct s_queue ttyinq[NUM_DEV_TTY+1] = { /* ttyinq[0] is never used */ { NULL, NULL, NULL, 0, 0, 0 }, @@ -69,7 +71,7 @@ void tty_data_consumed(uint8_t minor) { } -static uint8_t keymap[9]; +uint8_t keymap[9]; uint8_t keyin[9]; static uint8_t keybyte, keybit; static uint8_t newkey; @@ -131,7 +133,7 @@ static void keyproc(void) * FIXME: you can't currently load the symshift keymap. The core code * doesn't understand having a third translation table. */ -static uint8_t keyboard[9][8] = { +uint8_t keyboard[9][8] = { { 0 , 'z', 'x', 'c', 'v', KEY_F1, KEY_F2, KEY_F3 }, {'a', 's', 'd', 'f', 'g', KEY_F4, KEY_F5, KEY_F6 }, {'q', 'w', 'e', 'r', 't', KEY_F7, KEY_F8, KEY_F9 }, @@ -143,7 +145,7 @@ static uint8_t keyboard[9][8] = { {0/* CTRL*/, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, 0, 0, 0 } }; -static uint8_t shiftkeyboard[9][8] = { +uint8_t shiftkeyboard[9][8] = { { 0 , 'Z', 'X', 'C', 'V', KEY_PGUP, KEY_F2, KEY_F3 }, {'A', 'S', 'D', 'F', 'G', KEY_PGDOWN, KEY_F5, KEY_F6 }, {'Q', 'W', 'E', 'R', 'T', KEY_F7, KEY_F8, KEY_F9 }, @@ -204,11 +206,20 @@ static void keydecode(void) vt_inproc(1, c); } +static uint8_t kbd_timer; + void kbd_interrupt(void) { newkey = 0; keyproc(); - if (keysdown < 3 && newkey) - keydecode(); + if (keysdown && keysdown < 3) { + if (newkey) { + keydecode(); + kbd_timer = keyrepeat.first; + } else if (!--kbd_timer) { + keydecode(); + kbd_timer = keyrepeat.continual; + } + } } diff --git a/Kernel/platform-sam/devtty.h b/Kernel/platform-sam/devtty.h index 336152db..d1831cfe 100644 --- a/Kernel/platform-sam/devtty.h +++ b/Kernel/platform-sam/devtty.h @@ -5,4 +5,11 @@ extern void tty_interrupt(void); extern void kbd_interrupt(void); extern void keyscan(void); +#define KEY_ROWS 9 +#define KEY_COLS 8 + +extern uint8_t keymap[9]; +extern uint8_t keyboard[9][8]; +extern uint8_t shiftkeyboard[9][8]; + #endif