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>
ao_clock_init();
ao_serial_init();
+
+ ao_led_init(LEDS_AVAILABLE);
ao_stdio_init();
printf ("stdio initialized\n");
// ao_debug_init();
- ao_led_init(LEDS_AVAILABLE);
ao_timer_init();
ao_cmd_init();
ao_usb_init();
{
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