From: Brett Gordon Date: Thu, 3 Mar 2016 20:49:51 +0000 (-0500) Subject: coco3: Add key repeating for keyboard driver X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=6dc4b97c1d0419d6a1e8247b66dab76bd3144fa5;p=FUZIX.git coco3: Add key repeating for keyboard driver --- 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(); }