2019-07-29 06:15:54 +03:00
|
|
|
// Watchdog handler on STM32
|
2019-07-26 15:36:11 +03:00
|
|
|
//
|
|
|
|
// 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;
|
2019-07-28 21:40:41 +03:00
|
|
|
IWDG->RLR = 0x0FFF; // 410-512ms timeout (depending on stm32 chip)
|
2019-07-26 15:36:11 +03:00
|
|
|
IWDG->KR = 0xCCCC;
|
|
|
|
}
|
|
|
|
DECL_INIT(watchdog_init);
|