STM32H7: Reset Reason update

pull/10466/head
jeromecoutant 2019-02-27 15:03:10 +01:00
parent aa31b1268a
commit 8b6d0920a8
1 changed files with 22 additions and 0 deletions

View File

@ -27,18 +27,36 @@ reset_reason_t hal_reset_reason_get(void)
}
#endif
#ifdef RCC_FLAG_LPWR1RST
if ((__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR1RST))||(__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR2RST))) {
return RESET_REASON_WAKE_LOW_POWER;
}
#endif
#ifdef RCC_FLAG_WWDGRST
if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST)) {
return RESET_REASON_WATCHDOG;
}
#endif
#ifdef RCC_FLAG_WWDG1RST
if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDG1RST)) {
return RESET_REASON_WATCHDOG;
}
#endif
#ifdef RCC_FLAG_IWDGRST
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST)) {
return RESET_REASON_WATCHDOG;
}
#endif
#ifdef RCC_FLAG_IWDG1RST
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDG1RST)) {
return RESET_REASON_WATCHDOG;
}
#endif
#ifdef RCC_FLAG_SFTRST
if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST)) {
return RESET_REASON_SOFTWARE;
@ -69,7 +87,11 @@ reset_reason_t hal_reset_reason_get(void)
uint32_t hal_reset_reason_get_raw(void)
{
#if TARGET_STM32H7
return RCC->RSR;
#else /* TARGET_STM32H7 */
return RCC->CSR;
#endif /* TARGET_STM32H7 */
}