Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mBuDice SleepyCounting
Diff: mBuinoSleep.cpp
- Revision:
- 3:a3fd27c4a161
- Parent:
- 2:9586ea22ab1b
- Child:
- 4:c3f400cbe2fe
--- a/mBuinoSleep.cpp Sun Sep 21 11:01:27 2014 +0000 +++ b/mBuinoSleep.cpp Mon Sep 22 09:16:10 2014 +0000 @@ -15,6 +15,9 @@ progMode.mode(PullNone); + if ((mode == DeepPowerDown) && (LPC_PMU->PCON & 0x08)) // bit 3 high blocks deep power down. + mode = PowerDown; + switch (mode) { default: case Sleep: @@ -60,6 +63,11 @@ LPC_SYSCON->PDRUNCFG |= 0x01; // power down the IRC if it was off before } break; + case DeepPowerDown: + LPC_PMU->PCON = 0x3; + LPC_SYSCON->PDSLEEPCFG |= 0x7f; // shut off everything we can. + SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; + __WFI(); } LEDs = oldLEDState; }