#include "bsp.h"
void bsp_init_iwdg(void)
{
/* Enable write access to IWDG_PR and IWDG_RLR registers */
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
/* IWDG counter clock: LSI/64 */
IWDG_SetPrescaler(IWDG_Prescaler_64);//64分频 一个周期1.6ms 内部低速时钟LSI---40KHz 40k/64 = 625hz 1000ms/625hz = 1.6ms
IWDG_SetReload(800); //800*1.6=1280ms 1.28s复位一次
/* Reload IWDG counter */
IWDG_ReloadCounter();
/* Enable IWDG (the LSI oscillator will be enabled by hardware) */
IWDG_Enable();
}
void bsp_feed_dog(void)
{
/* Reload IWDG counter */
IWDG_ReloadCounter();
}