diff options
author | root <root@lamia.panaceas.james.local> | 2015-06-07 02:35:01 +0100 |
---|---|---|
committer | root <root@lamia.panaceas.james.local> | 2015-06-07 02:35:01 +0100 |
commit | cdea4f5da56c6158beccc801f0a4efa045cf46cb (patch) | |
tree | 456a1677aff4cd0f08a9461d72659ec20b4e0c8b /app/atkbd.c | |
parent | 7fa21387755e96ea0403ff4213af8a053811b81d (diff) | |
download | tims_keyboard-cdea4f5da56c6158beccc801f0a4efa045cf46cb.tar.gz tims_keyboard-cdea4f5da56c6158beccc801f0a4efa045cf46cb.tar.bz2 tims_keyboard-cdea4f5da56c6158beccc801f0a4efa045cf46cb.zip |
tidy up makefiles and fix init delay
Diffstat (limited to 'app/atkbd.c')
-rw-r--r-- | app/atkbd.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/app/atkbd.c b/app/atkbd.c index 9091636..1ba599a 100644 --- a/app/atkbd.c +++ b/app/atkbd.c @@ -67,6 +67,8 @@ typedef enum +static int ready; +static uint8_t saved_leds; static int atkbd_ack; static int atkbd_nack; @@ -396,7 +398,14 @@ atkbd_request_echo (void) int atkbd_set_leds (uint8_t leds) { - uint32_t then = ticks; + uint32_t then; + + saved_leds = leds; + + if (!ready) + return 0; + + then = ticks; atkbd_ack = 0; atkbd_send (ATKBD_CMD_SETLEDS); while (!atkbd_ack) @@ -462,10 +471,22 @@ atkbd_set_mbr (void) void +atkbd_start (void) +{ + + atkbd_reset (); + atkbd_request_echo (); + atkbd_set_mbr (); + atkbd_set_scanset (2); + atkbd_set_leds (saved_leds); + + ready++; +} + +void atkbd_init (void) { atkbd_set (1, 1); - delay_ms (200); nvic_enable_irq (NVIC_EXTI0_IRQ); @@ -478,11 +499,5 @@ atkbd_init (void) nvic_enable_irq (KBCLK_IRQ); - atkbd_reset (); - atkbd_request_echo (); - atkbd_set_mbr (); - atkbd_set_scanset (2); - atkbd_set_leds (0); - } |