X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao_panic.c;h=30ccce60bdc57ba2dd6a05c3d58a9e7466562e92;hp=9f9167d8f79be95e899c488bab5e63cc491d1437;hb=ac99982b10fd5772218660137ee21db9b90cd885;hpb=1903a86bf2cc6b685ccc475e62eabe49a4ec5b43 diff --git a/ao_panic.c b/ao_panic.c index 9f9167d8..30ccce60 100644 --- a/ao_panic.c +++ b/ao_panic.c @@ -3,8 +3,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,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); + } }