diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-12-06 19:17:46 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-12-06 19:17:46 +0100 |
commit | 9b0492d105154b580b04ee1d5f8eef686f23cd4a (patch) | |
tree | afd44f3fadbc546dcf4d5d198729da8e332e23a6 | |
parent | 5b3ab9f2ac3dca746d05f43554a04f17bfcdfce6 (diff) | |
download | kbd-9b0492d105154b580b04ee1d5f8eef686f23cd4a.tar kbd-9b0492d105154b580b04ee1d5f8eef686f23cd4a.zip |
Some blinking stuff
-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; } - |