Fixes #2790: power on/off lop if big VCC capcitor was used
This commit is contained in:
@@ -87,29 +87,25 @@ void pwrOff()
|
||||
// disable interrupts
|
||||
__disable_irq();
|
||||
|
||||
|
||||
#if defined(REV9E)
|
||||
// 9E needs watchdog reset because CPU is still running while
|
||||
// the power key is held pressed by the user.
|
||||
// The power key should be released by now, but we must make sure
|
||||
while (pwrPressed()) {
|
||||
wdt_reset();
|
||||
}
|
||||
// Put the CPU into sleep to reduce the consumption,
|
||||
// it might help with the RTC reset issue
|
||||
PWR->CR |= PWR_CR_CWUF;
|
||||
/* Select STANDBY mode */
|
||||
PWR->CR |= PWR_CR_PDDS;
|
||||
/* Set SLEEPDEEP bit of Cortex System Control Register */
|
||||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||
/* Request Wait For Event */
|
||||
__WFE();
|
||||
#endif
|
||||
|
||||
while(1) {
|
||||
wdt_reset();
|
||||
#if defined(REV9E)
|
||||
// 9E needs watchdog reset because CPU is still running while
|
||||
// the power key is held pressed by the user.
|
||||
// The power key should be released by now, but we must make sure
|
||||
if (!pwrPressed()) {
|
||||
// Put the CPU into sleep to reduce the consumption,
|
||||
// it might help with the RTC reset issue
|
||||
PWR->CR |= PWR_CR_CWUF;
|
||||
/* Select STANDBY mode */
|
||||
PWR->CR |= PWR_CR_PDDS;
|
||||
/* Set SLEEPDEEP bit of Cortex System Control Register */
|
||||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||
/* Request Wait For Event */
|
||||
__WFE();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//this function must not return!
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user