diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-07-28 23:15:54 -0400 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-08-05 11:25:40 -0400 |
commit | 8b9cc62359057a686929cc713ffe2931e2203946 (patch) | |
tree | ab2e5469d7919cc6ed652e2928f0eaf9a24420c3 /src/stm32/watchdog.c | |
parent | ec3d865b517affd77678e5b1a45ef4691619726d (diff) | |
download | kutter-8b9cc62359057a686929cc713ffe2931e2203946.tar.gz kutter-8b9cc62359057a686929cc713ffe2931e2203946.tar.xz kutter-8b9cc62359057a686929cc713ffe2931e2203946.zip |
stm32: Rename stm32f4/ directory to stm32/
Now that the code in stm32f4/ can handle both stm32f1 and stm32f4
chips, rename the directory to just "stm32".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/watchdog.c')
-rw-r--r-- | src/stm32/watchdog.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/stm32/watchdog.c b/src/stm32/watchdog.c new file mode 100644 index 00000000..696d64d6 --- /dev/null +++ b/src/stm32/watchdog.c @@ -0,0 +1,25 @@ +// Watchdog handler on STM32 +// +// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net> +// +// This file may be distributed under the terms of the GNU GPLv3 license. + +#include "internal.h" // IWDG +#include "sched.h" // DECL_TASK + +void +watchdog_reset(void) +{ + IWDG->KR = 0xAAAA; +} +DECL_TASK(watchdog_reset); + +void +watchdog_init(void) +{ + IWDG->KR = 0x5555; + IWDG->PR = 0; + IWDG->RLR = 0x0FFF; // 410-512ms timeout (depending on stm32 chip) + IWDG->KR = 0xCCCC; +} +DECL_INIT(watchdog_init); |