#include "stm32g4xx.h"

#include "iwdg.h"

void InitIWDG(unsigned short Reload)
{
  IWDG->KR=0x0000CCCC;
  IWDG->KR=0x00005555;
  IWDG->PR=0;
  IWDG->RLR=Reload;
  while(IWDG->SR) { asm volatile("NOP"); }
  IWDG->KR=0x0000AAAA;
}

void PingIWDG()
{
  IWDG->KR=0x0000AAAA;
}
