From a41bc5a7cadb5bea9b7800286b2f4ea4f9b26e1a Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 23 Feb 2022 09:37:48 +1100 Subject: [PATCH] stm32/modmachine: Add deepsleep support to reset_cause() for WB55. --- ports/stm32/modmachine.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index 57b8ef5e6b..0239ea64ca 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -119,6 +119,12 @@ void machine_init(void) { reset_cause = PYB_RESET_DEEPSLEEP; PWR->SCR |= PWR_SCR_CSBF; } else + #elif defined(STM32WB) + if (PWR->EXTSCR & PWR_EXTSCR_C1SBF) { + // came out of standby + reset_cause = PYB_RESET_DEEPSLEEP; + PWR->EXTSCR |= PWR_EXTSCR_C1CSSF; + } else #endif { // get reset cause from RCC flags