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.
Revision 2:9c5cd0f7aa8a, committed 2014-09-28
- Comitter:
- AndyA
- Date:
- Sun Sep 28 09:24:32 2014 +0000
- Parent:
- 1:219e1147c6fa
- Commit message:
- Added watchdog modes
Changed in this revision
| mBuinoSleep.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mBuinoSleep.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/mBuinoSleep.cpp Mon Sep 22 09:15:52 2014 +0000
+++ b/mBuinoSleep.cpp Sun Sep 28 09:24:32 2014 +0000
@@ -15,13 +15,19 @@
break;
case DeepSleep:
- case PowerDown: {
- if (mode == PowerDown)
+ case PowerDown:
+ case PowerDownWD:
+ case DeepSleepWD: {
+ if ((mode == PowerDown) || (mode == PowerDownWD))
LPC_PMU->PCON = 0x2;
else
LPC_PMU->PCON = 0x1;
LPC_SYSCON->PDSLEEPCFG |= 0x7f; // shut off everything we can.
+
+ if ((mode == DeepSleepWD) || (mode == PowerDownWD))
+ LPC_SYSCON->PDSLEEPCFG &= ~(1<<6);
+
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
bool IRCPowered = (LPC_SYSCON->PDRUNCFG & 0x01); // only used for cleen shutdown but defined here for scope reasons.
--- a/mBuinoSleep.h Mon Sep 22 09:15:52 2014 +0000
+++ b/mBuinoSleep.h Sun Sep 28 09:24:32 2014 +0000
@@ -3,7 +3,7 @@
#include "mbed.h"
-enum sleepMode_t {Sleep, DeepSleep, PowerDown, DeepPowerDown};
+enum sleepMode_t {Sleep, DeepSleep, DeepSleepWD, PowerDown, PowerDownWD, DeepPowerDown};
void mBuinoSleep(enum sleepMode_t mode);