#include "iwdg.h"

IWDG_HandleTypeDef hiwdg;

void IWDG_Configuration(void)
{	
    IWDG_ENABLE_WRITE_ACCESS(&hiwdg);
		// 4 		min:0.125ms  	max:512ms
		// 8 		min:0.25ms  	max:1024ms
		// 16 	min:0.5ms  		max:2048ms
		// 32 	min:1ms  			max:4096ms
		// 64 	min:2ms  			max:8192ms
		// 128	min:4ms  			max:16384ms
		// 256	min:8ms  			max:32768ms
		hiwdg.Instance = IWDG;
		hiwdg.Init.Prescaler = IWDG_PRESCALER_64;
		hiwdg.Init.Reload = 8000;
		HAL_IWDG_Init(&hiwdg);
}

void feedDog(void)
{
	HAL_IWDG_Refresh(&hiwdg);
}