Files
@ 7fc667dd7f38
Branch filter:
Location: therm-ng/src/system/watchdog.c - annotation
7fc667dd7f38
746 B
text/plain
Decent working pid
667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f | //
// Watchdog: configure and initialize the watchdog peripheral
//
#include "stm32f3xx_hal.h"
#include "config.h"
#include "watchdog.h"
#ifdef WATCHDOG_ENABLE
static IWDG_HandleTypeDef hiwdg;
uint8_t watchdog_enabled = 0;
#endif
// Initialize the watchdog timer
void watchdog_init(void)
{
#ifdef WATCHDOG_ENABLE
// ~2 seconds?
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_4;
hiwdg.Init.Window = 4095;
hiwdg.Init.Reload = 4095;
HAL_IWDG_Init(&hiwdg);
watchdog_feed();
HAL_IWDG_Start(&hiwdg);
watchdog_enabled = 1;
#endif
}
// Feed the watchdog timer
void watchdog_feed(void)
{
#ifdef WATCHDOG_ENABLE
if(watchdog_enabled)
HAL_IWDG_Refresh(&hiwdg);
#endif
}
|