summaryrefslogtreecommitdiff
path: root/src-avr/ao_led.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-05-18 00:17:04 -0700
committerKeith Packard <keithp@keithp.com>2011-05-18 00:17:04 -0700
commitf2c9234341b18d94c6056d72a496753c64619f08 (patch)
treeebe604a5bc1b15034634735e63ff02e4a3a200a7 /src-avr/ao_led.c
parente7e2fdf45dfbf6393ee0a0ec22e1e5ea49d6cfd5 (diff)
src-avr: Trap accidental restart
Use the LED output pin to notice when avr-demo accidentally restarts and print out an error message in that case. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src-avr/ao_led.c')
-rw-r--r--src-avr/ao_led.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src-avr/ao_led.c b/src-avr/ao_led.c
index 0e69ee3a..5183140b 100644
--- a/src-avr/ao_led.c
+++ b/src-avr/ao_led.c
@@ -63,6 +63,10 @@ ao_led_init(uint8_t enable)
{
ao_led_enable = enable;
#ifdef AVR
+ if ((LED_DDR & enable)) {
+ printf ("oops! restarted\n");
+ ao_panic(AO_PANIC_REBOOT);
+ }
LED_PORT &= ~enable;
LED_DDR |= enable;
#else