refactor: IWDG driver and EM trigger (#3846)

This commit is contained in:
Raphael Coeffic
2023-12-04 07:14:25 +10:00
committed by GitHub
parent e18a2a90a4
commit 5153aaeea0
89 changed files with 1204 additions and 3202 deletions
+1 -18
View File
@@ -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)