40 #if defined(STM32F40_41xxx) || defined(STM32F446xx)
41 #include "stm32f4xx_iwdg.h"
42 #include "stm32f4xx_dbgmcu.h"
43 #include "stm32f4xx_rtc.h"
44 #elif defined(STM32F30X)
45 #include "stm32f30x_iwdg.h"
46 #include "stm32f30x_dbgmcu.h"
47 #include "stm32f30x_rtc.h"
48 #elif defined(STM32F10X_MD)
49 #include "stm32f10x_iwdg.h"
50 #include "stm32f10x_dbgmcu.h"
52 #define RTC_ReadBackupRegister BKP_ReadBackupRegister
53 #define RTC_WriteBackupRegister BKP_WriteBackupRegister
54 #elif defined(STM32F0XX)
55 #include "stm32f0xx_iwdg.h"
56 #include "stm32f0xx_dbgmcu.h"
58 #error Attempted to build on unsupported target
61 #if defined(PIOS_WDG_REGISTER)
62 static struct wdg_configuration {
64 uint16_t bootup_flags;
89 #if defined(PIOS_INCLUDE_WDG)
90 DBGMCU_Config(DBGMCU_IWDG_STOP, ENABLE);
91 IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
92 IWDG_SetPrescaler(IWDG_Prescaler_16);
93 IWDG_SetReload(delay);
99 #ifdef PIOS_WDG_REGISTER
101 PWR_BackupAccessCmd(ENABLE);
110 #endif // PIOS_WDG_REGISTER
115 #ifdef PIOS_WDG_REGISTER
133 if(wdg_configuration.used_flags & flag_requested)
137 wdg_configuration.used_flags |= flag_requested;
155 if ((wdg_configuration.used_flags & flag) == 0) {
165 if((cur_flags | flag) == wdg_configuration.used_flags) {
185 return wdg_configuration.bootup_flags;
199 #endif //PIOS_WDG_REGISTER
208 #if defined(PIOS_INCLUDE_WDG)
209 IWDG_ReloadCounter();
Main PiOS header to include all the compiled in PiOS options.
#define PIOS_WATCHDOG_TIMEOUT
bool PIOS_WDG_RegisterFlag(uint16_t flag_requested)
Register a module against the watchdog.
bool PIOS_WDG_UpdateFlag(uint16_t flag)
Function called by modules to indicate they are still running.
uint16_t PIOS_WDG_GetBootupFlags()
Returns the flags that were set at bootup.
uint16_t PIOS_WDG_GetActiveFlags()
Returns the currently active flags.
void PIOS_WDG_Clear(void)
Clear the watchdog timer.
#define PIOS_WDG_REGISTER
uint16_t PIOS_WDG_Init()
Initialize the watchdog timer for a specified timeout.
#define PIOS_Assert(test)