diff options
-rw-r--r-- | ardkbd.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -11,6 +11,9 @@ static volatile uint8_t kbd_input = 0; static volatile uint8_t kbd_flags = 0; +static volatile uint8_t ts = 10; + + #define KBD_FLAG_ERROR (_BV(0)) #define KBD_FLAG_BREAK (_BV(1)) #define KBD_FLAG_EXT (_BV(2)) @@ -84,10 +87,13 @@ ISR(PCINT1_vect) { if (!(kbd_flags & KBD_FLAG_BREAK)) { switch (code) { case KBD_CODE_UP: - PORTB = 0x20; + if (ts > 0) + ts--; break; case KBD_CODE_DOWN: + if (ts < 31) + ts++; PORTB = 0; break; } @@ -109,8 +115,12 @@ int main(void) { sei(); while(true) { + PORTB ^= 0x20; + + uint32_t i; + for (i = 0; i < (1 << ts); i++) + _delay_ms(1); } return 0; } - |