From c012d715bf3c3ce72e72268043a35d1385a4d59d Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 23 Apr 2019 17:02:19 -0400 Subject: [PATCH] add watchdog timer to planck ez --- keyboards/planck/ez/ez.c | 10 ++++++++++ quantum/stm32/halconf.h | 2 +- quantum/stm32/mcuconf.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index b859af6c15b..7c787ca0b40 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -137,6 +137,13 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { {{3|(4<<4)}, {20.36*11,21.33*3}, 1} }; +static const WDGConfig wdognormalcfg = +{ + STM32_IWDG_PR_64, + STM32_IWDG_RL(1000), + STM32_IWDG_WIN_DISABLED +}; + void matrix_init_kb(void) { matrix_init_user(); @@ -145,9 +152,12 @@ void matrix_init_kb(void) { palClearPad(GPIOB, 8); palClearPad(GPIOB, 9); + + wdgStart(&WDGD1, &wdognormalcfg); } void matrix_scan_kb(void) { + wdgReset(&WDGD1); matrix_scan_user(); } diff --git a/quantum/stm32/halconf.h b/quantum/stm32/halconf.h index c3e0cbb728c..0dba3ce308e 100644 --- a/quantum/stm32/halconf.h +++ b/quantum/stm32/halconf.h @@ -174,7 +174,7 @@ * @brief Enables the WDG subsystem. */ #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) -#define HAL_USE_WDG FALSE +#define HAL_USE_WDG TRUE #endif /*===========================================================================*/ diff --git a/quantum/stm32/mcuconf.h b/quantum/stm32/mcuconf.h index 36f8ca2252a..8ebf7509553 100644 --- a/quantum/stm32/mcuconf.h +++ b/quantum/stm32/mcuconf.h @@ -252,6 +252,6 @@ /* * WDG driver system settings. */ -#define STM32_WDG_USE_IWDG FALSE +#define STM32_WDG_USE_IWDG TRUE #endif /* MCUCONF_H */