From 6dc4b97c1d0419d6a1e8247b66dab76bd3144fa5 Mon Sep 17 00:00:00 2001 From: Brett Gordon Date: Thu, 3 Mar 2016 15:49:51 -0500 Subject: [PATCH] coco3: Add key repeating for keyboard driver --- Kernel/platform-coco3/devtty.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Kernel/platform-coco3/devtty.c b/Kernel/platform-coco3/devtty.c index 84d5553a..01a9d70d 100644 --- a/Kernel/platform-coco3/devtty.c +++ b/Kernel/platform-coco3/devtty.c @@ -275,6 +275,9 @@ static int keysdown = 0; static uint8_t shiftmask[8] = { 0, 0, 0, 0x40, 0x40, 0, 0, 0x40 }; +static uint8_t timer = 0 ; +#define REPEAT_DELAY0 30 ; /* delay ticks before first repeat */ +#define REPEAT_DELAY1 10 ; /* delay ticks on sucessive repeats */ /* a lookup table to rotate a 0 bit around */ static uint8_t rbit[8] = { @@ -448,8 +451,18 @@ void platform_interrupt(void) *pia_col; newkey = 0; keyproc(); - if (keysdown < 3 && newkey) - keydecode(); + if (keysdown && (keysdown < 3) ){ + if(newkey){ + keydecode(); + timer = REPEAT_DELAY0 ; + } + else{ + if( ! --timer ){ + keydecode(); + timer = REPEAT_DELAY1 ; + } + } + } timer_interrupt(); dw_vpoll(); } -- 2.34.1