Files
@ 574fd84a2bf8
Branch filter:
Location: therm-ng/src/system/watchdog.c - annotation
574fd84a2bf8
767 B
text/plain
Added options for number of setpoints and aux input enable
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
}
|