stm32/modmachine: Fix reset_cause to correctly give DEEPSLEEP on L4 MCU.

Before this fix it returned SOFT_RESET after waking from a deepsleep
(standby).
This commit is contained in:
roland 2018-12-27 18:04:00 +01:00 committed by Damien George
parent f334816df0
commit 4d8504425a
1 changed files with 6 additions and 0 deletions

View File

@ -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