refactor: IWDG driver and EM trigger (#3846)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "hal/trainer_driver.h"
|
||||
#include "hal/switch_driver.h"
|
||||
#include "hal/module_port.h"
|
||||
#include "hal/abnormal_reboot.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "boards/generic_stm32/module_ports.h"
|
||||
@@ -62,26 +63,8 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT)
|
||||
bool UNEXPECTED_SHUTDOWN()
|
||||
{
|
||||
return WAS_RESET_BY_WATCHDOG()
|
||||
|| g_eeGeneral.unexpectedShutdown;
|
||||
}
|
||||
#endif
|
||||
|
||||
HardwareOptions hardwareOptions;
|
||||
|
||||
void watchdogInit(unsigned int duration)
|
||||
{
|
||||
IWDG->KR = 0x5555; // Unlock registers
|
||||
IWDG->PR = 3; // Divide by 32 => 1kHz clock
|
||||
IWDG->KR = 0x5555; // Unlock registers
|
||||
IWDG->RLR = duration;
|
||||
IWDG->KR = 0xAAAA; // reload
|
||||
IWDG->KR = 0xCCCC; // start
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
|
||||
Reference in New Issue
Block a user