X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=ao_panic.c;h=30ccce60bdc57ba2dd6a05c3d58a9e7466562e92;hb=902c342289c1d13a4d55b9224acb6d67578b7a60;hp=c9c63b21de0067c8396ffcf4765388214d692052;hpb=870e98334018a66de8a6e4a659d2dc5dee1cbecf;p=fw%2Faltos diff --git a/ao_panic.c b/ao_panic.c index c9c63b21..30ccce60 100644 --- a/ao_panic.c +++ b/ao_panic.c @@ -17,10 +17,36 @@ #include "ao.h" +static void +ao_panic_delay(uint8_t n) +{ + uint8_t i = 0; + + while (n--) + while (--i) + _asm nop _endasm; +} + void ao_panic(uint8_t reason) { - (void) reason; - for (;;) - ; + uint8_t n; + + for (;;) { + ao_led_on(AO_LED_RED); + ao_beep(AO_BEEP_MID); + ao_panic_delay(2); + ao_led_off(AO_LED_RED); + ao_beep(AO_BEEP_OFF); + ao_panic_delay(2); + for (n = 0; n < reason; n++) { + ao_led_on(AO_LED_RED); + ao_beep(AO_BEEP_MID); + ao_panic_delay(1); + ao_led_off(AO_LED_RED); + ao_beep(AO_BEEP_OFF); + ao_panic_delay(1); + } + ao_panic_delay(2); + } }