From 6247e0c81084b59365ceca0ced33d2db92a72444 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 1 Feb 2014 00:06:30 -0800 Subject: [PATCH] altos/fox: Enable system timer in flash loader and prod watchdog with it This makes it possible to reflash the board without needing to disable the watchdog. Signed-off-by: Keith Packard --- src/fox1ihu/flash-loader/ao_pins.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/fox1ihu/flash-loader/ao_pins.h b/src/fox1ihu/flash-loader/ao_pins.h index 3a942c9c..90917a38 100644 --- a/src/fox1ihu/flash-loader/ao_pins.h +++ b/src/fox1ihu/flash-loader/ao_pins.h @@ -21,6 +21,20 @@ /* External crystal at 8MHz */ #define AO_HSE 8000000 +#define AO_WATCHDOG_PORT (&stm_gpiod) +#define AO_WATCHDOG_BIT 3 + +#define AO_FLASH_LOADER_INIT do { \ + ao_enable_output(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, AO_WATCHDOG, 0); \ + } while (0) + +#define AO_TIMER_HOOK do { \ + static uint8_t watchdog; \ + ao_gpio_set(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, AO_WATCHDOG_PIN, watchdog); \ + watchdog ^= 1; \ + } while (0) + +#define HAS_TICK 1 #include /* Detatched signal, PD6 */ -- 2.30.2