mirror of
https://github.com/binary-kitchen/doorlockd
synced 2025-01-02 22:45:23 +01:00
avr: support emergency unlock
Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
parent
698a96e46b
commit
5fd19def77
@ -35,6 +35,7 @@ enum state_source {
|
||||
BUTTON,
|
||||
COMM,
|
||||
TIMEOUT,
|
||||
EMERGENCY,
|
||||
};
|
||||
|
||||
static inline void set_schnapper(bool state)
|
||||
@ -120,8 +121,16 @@ static void update_state(unsigned char new_state, enum state_source source)
|
||||
break;
|
||||
}
|
||||
|
||||
if (source == BUTTON)
|
||||
switch (source) {
|
||||
case BUTTON:
|
||||
ret = toupper(ret);
|
||||
break;
|
||||
case EMERGENCY:
|
||||
ret = 'E';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uart_putc(ret);
|
||||
}
|
||||
@ -207,6 +216,9 @@ int main(void)
|
||||
sei();
|
||||
|
||||
for (;;) {
|
||||
if (is_emergency()) {
|
||||
update_state(GREEN, EMERGENCY);
|
||||
} else {
|
||||
i = get_keys();
|
||||
if (i & GREEN)
|
||||
update_state(GREEN, BUTTON);
|
||||
@ -214,6 +226,7 @@ int main(void)
|
||||
update_state(YELLOW, BUTTON);
|
||||
else if (i & RED)
|
||||
update_state(RED, BUTTON);
|
||||
}
|
||||
set_leds();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user