/** * @brief Initialise and start the watchdog * * The prescaler and reload set the timeout. A prescaler of 3 divides * the 40 kHz clock by 32 and gives roughly 1 ms per reload. * * @param prescaler Prescaler for the 40 KHz IWDG clock. * @param reload Independent watchdog counter reload value. */ void iwdg_init(iwdg_prescaler prescaler, uint16 reload) { IWDG_BASE->KR = IWDG_KR_UNLOCK; IWDG_BASE->PR = prescaler; IWDG_BASE->RLR = reload; /* Start things off */ IWDG_BASE->KR = IWDG_KR_START; iwdg_feed(); }
void watchdog_reset() { #if PIN_EXISTS(LED) TOGGLE(LED_PIN); // heartbeat indicator #endif iwdg_feed(); }
void watchdog_reload(void){ iwdg_feed(); }