From ceb21b733b1ecb5540304af5bb863dbb44910c30 Mon Sep 17 00:00:00 2001 From: Marc Desvaux Date: Wed, 22 Mar 2023 11:00:04 +0100 Subject: [PATCH] samples: boards: stm32: pm: standby_shutdown: use hwinfo_get_reset_cause() use hwinfo_get_reset_cause() instead of LL_PWR_IsActiveFlag_SB() remove LL_PWR_ClearFlag_WU() not mandatory Signed-off-by: Marc Desvaux --- .../boards/stm32/power_mgmt/standby_shutdown/src/main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/samples/boards/stm32/power_mgmt/standby_shutdown/src/main.c b/samples/boards/stm32/power_mgmt/standby_shutdown/src/main.c index 118ecaafc7f..d58c17f1c76 100644 --- a/samples/boards/stm32/power_mgmt/standby_shutdown/src/main.c +++ b/samples/boards/stm32/power_mgmt/standby_shutdown/src/main.c @@ -96,19 +96,16 @@ void main(void) hwinfo_get_reset_cause(&cause); hwinfo_clear_reset_cause(); - if ((LL_PWR_IsActiveFlag_SB() == true) && (cause == 0)) { - LL_PWR_ClearFlag_SB(); - LL_PWR_ClearFlag_WU(); + if (cause == RESET_LOW_POWER_WAKE) { + hwinfo_clear_reset_cause(); printk("\nReset cause: Standby mode\n\n"); } if (cause == (RESET_PIN | RESET_BROWNOUT)) { - LL_PWR_ClearFlag_WU(); printk("\nReset cause: Shutdown mode or power up\n\n"); } if (cause == RESET_PIN) { - LL_PWR_ClearFlag_WU(); printk("\nReset cause: Reset pin\n\n"); }