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,
|
BUTTON,
|
||||||
COMM,
|
COMM,
|
||||||
TIMEOUT,
|
TIMEOUT,
|
||||||
|
EMERGENCY,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void set_schnapper(bool state)
|
static inline void set_schnapper(bool state)
|
||||||
@ -120,8 +121,16 @@ static void update_state(unsigned char new_state, enum state_source source)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source == BUTTON)
|
switch (source) {
|
||||||
|
case BUTTON:
|
||||||
ret = toupper(ret);
|
ret = toupper(ret);
|
||||||
|
break;
|
||||||
|
case EMERGENCY:
|
||||||
|
ret = 'E';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
uart_putc(ret);
|
uart_putc(ret);
|
||||||
}
|
}
|
||||||
@ -207,13 +216,17 @@ int main(void)
|
|||||||
sei();
|
sei();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
i = get_keys();
|
if (is_emergency()) {
|
||||||
if (i & GREEN)
|
update_state(GREEN, EMERGENCY);
|
||||||
update_state(GREEN, BUTTON);
|
} else {
|
||||||
else if (i & YELLOW)
|
i = get_keys();
|
||||||
update_state(YELLOW, BUTTON);
|
if (i & GREEN)
|
||||||
else if (i & RED)
|
update_state(GREEN, BUTTON);
|
||||||
update_state(RED, BUTTON);
|
else if (i & YELLOW)
|
||||||
|
update_state(YELLOW, BUTTON);
|
||||||
|
else if (i & RED)
|
||||||
|
update_state(RED, BUTTON);
|
||||||
|
}
|
||||||
set_leds();
|
set_leds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user