summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/stm32/modmachine.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c
index 7c8104b13..06c07812c 100644
--- a/ports/stm32/modmachine.c
+++ b/ports/stm32/modmachine.c
@@ -105,6 +105,12 @@ void machine_init(void) {
reset_cause = PYB_RESET_DEEPSLEEP;
PWR->CPUCR |= PWR_CPUCR_CSSF;
} else
+ #elif defined(STM32L4)
+ if (PWR->SR1 & PWR_SR1_SBF) {
+ // came out of standby
+ reset_cause = PYB_RESET_DEEPSLEEP;
+ PWR->SCR |= PWR_SCR_CSBF;
+ } else
#endif
{
// get reset cause from RCC flags