Add generic function to detzermine reset cuase to rcc manager
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <reflow-controller/safety/safety-memory.h>
|
||||
#include <reflow-controller/oven-driver.h>
|
||||
#include <helper-macros/helper-macros.h>
|
||||
#include <stm-periph/rcc-manager.h>
|
||||
|
||||
#define check_flag_persistent(flag) ((flag)->persistency && (flag)->persistency->persistency)
|
||||
#define get_flag_weight(flag) ((flag)->weight ? (flag->weight->weight) : SAFETY_FLAG_CONFIG_WEIGHT_NONE)
|
||||
@@ -513,7 +514,7 @@ void safety_controller_init()
|
||||
safety_adc_init();
|
||||
watchdog_setup(WATCHDOG_PRESCALER);
|
||||
|
||||
if (watchdog_check_reset_source())
|
||||
if (rcc_manager_get_reset_cause(false) & RCC_RESET_SOURCE_IWDG)
|
||||
safety_controller_report_error(ERR_FLAG_WTCHDG_FIRED);
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
|
@@ -105,16 +105,4 @@ int watchdog_ack(uint32_t magic)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool watchdog_check_reset_source(void)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
ret = !!(RCC->CSR & RCC_CSR_WDGRSTF);
|
||||
|
||||
if (ret)
|
||||
RCC->CSR |= RCC_CSR_RMVF;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
Reference in New Issue
Block a user