altos/fox: Enable system timer in flash loader and prod watchdog with it
authorKeith Packard <keithp@keithp.com>
Sat, 1 Feb 2014 08:06:30 +0000 (00:06 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 27 Apr 2018 02:33:48 +0000 (19:33 -0700)
This makes it possible to reflash the board without needing to disable
the watchdog.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/fox1ihu/flash-loader/ao_pins.h

index 3a942c9c3886ac79e47fc880114ed59f39639a91..90917a3840d5ab56eff7cfc0c1a242c3494b74dd 100644 (file)
 /* External crystal at 8MHz */
 #define AO_HSE         8000000
 
 /* 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 <ao_flash_stm_pins.h>
 
 /* Detatched signal, PD6 */
 #include <ao_flash_stm_pins.h>
 
 /* Detatched signal, PD6 */