Files
@ c1b2840961f0
Branch filter:
Location: therm-ng/src/system/watchdog.c - annotation
c1b2840961f0
767 B
text/plain
Hacking thermostatic mode into operation. This code needs some love.
667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f b61e1f4d75c5 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f b61e1f4d75c5 b61e1f4d75c5 b61e1f4d75c5 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f 667b32311f8f b61e1f4d75c5 b61e1f4d75c5 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
}
|