//todo: have config struct, calc timeout based on PS_DIV void iwdgPreStart(void) { //void iwdgStart(void) { // was this a reset caused by the iwdg? if( (RCC->CSR & RCC_CSR_WDGRSTF) != 0) { //! \todo Log WDG reset event somewhere. RCC->CSR = RCC->CSR | RCC_CSR_RMVF; // clear the IWDGRSTF } iwdg_lld_set_prescale(IWDG_PS_DIV32); // This should be about 2 seconds at 32kHz //iwdg_lld_set_prescale(IWDG_PS_DIV128); iwdg_lld_init(); }
/** * @brief IWDG Driver initialization. * @note This function is implicitly invoked by @p halInit(), there is * no need to explicitly initialize the driver. * * @init */ void iwdgInit(void) { iwdg_lld_init(); }