Some blinking stuff
This commit is contained in:
parent
5b3ab9f2ac
commit
9b0492d105
1 changed files with 12 additions and 2 deletions
14
ardkbd.c
14
ardkbd.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue