implement LP1768 power mode
Fork of steven_powercontrol by
Revision 1:2976b5aa967b, committed 2014-08-01
- Comitter:
- steniu01
- Date:
- Fri Aug 01 17:04:39 2014 +0000
- Parent:
- 0:fc6cd61e7460
- Commit message:
- this is the first release version
Changed in this revision
powercontrol.h | Show annotated file Show diff for this revision Revisions of this file |
steven_powercontrol.h | Show diff for this revision Revisions of this file |
diff -r fc6cd61e7460 -r 2976b5aa967b powercontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/powercontrol.h Fri Aug 01 17:04:39 2014 +0000 @@ -0,0 +1,52 @@ +//sleep mode +void steven_Sleep(void) { + + LPC_SC->PCON=0x0; + // SRC[SLEEPDEEP] set to 0 = sleep, this bit control whether the processor uses sleep or deep sleep as its low power mode + SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; + + // wait for interrupt + __WFI(); +} +// "Deep Sleep" mode +void steven_DeepSleep(void) { + + + // PCON[PD] set to DeepSleep + LPC_SC->PCON = 0x0; + + // SRC[SLEEPDEEP] set to 0 = DeepSleep + SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; + + // wait for interrupt + __WFI(); +} + +//"Power-Down" Mode +void steven_PowerDown(void) +{ + SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; + LPC_SC->PCON=0x1; // PM1=0, PM0=1, enter power down mode if the SLEEPDEEP bit in SCR is 1 + __WFI(); + //reset back to normal + LPC_SC->PCON = 0x1; +} + +//"Deep Power-Down" Mode +void steven_DeepPowerDown(void) +{ + SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; + LPC_SC->PCON = 0x3;//// PM1=1, PM0=1, enter deep power down mode if the SLEEPDEEP bit in SCR is 1 + __WFI(); + //reset back to normal + LPC_SC->PCON =0x0; +} + +// "Brown-out Reduced Power mode" +void steven_BOGD_PowerDown(void) +{ + LPC_SC->PCON=0x1d; // PM1=0, PM0=1, enter power down mode if the SLEEPDEEP bit in SCR is 1; BOGD + SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; + __WFI(); +} + \ No newline at end of file
diff -r fc6cd61e7460 -r 2976b5aa967b steven_powercontrol.h --- a/steven_powercontrol.h Mon Jul 21 13:46:25 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -//sleep mode -void steven_Sleep(void) { - - LPC_SC->PCON=0x0; - // SRC[SLEEPDEEP] set to 0 = sleep, this bit control whether the processor uses sleep or deep sleep as its low power mode - SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; - - // wait for interrupt - __WFI(); -} -// "Deep Sleep" mode -void steven_DeepSleep(void) { - - - // PCON[PD] set to DeepSleep - LPC_SC->PCON = 0x0; - - // SRC[SLEEPDEEP] set to 0 = DeepSleep - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - - // wait for interrupt - __WFI(); -} - -//"Power-Down" Mode -void steven_PowerDown(void) -{ - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - LPC_SC->PCON=0x1; // PM1=0, PM0=1, enter power down mode if the SLEEPDEEP bit in SCR is 1 - __WFI(); - //reset back to normal - LPC_SC->PCON = 0x1; -} - -//"Deep Power-Down" Mode -void steven_DeepPowerDown(void) -{ - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - LPC_SC->PCON = 0x3;//// PM1=1, PM0=1, enter deep power down mode if the SLEEPDEEP bit in SCR is 1 - __WFI(); - //reset back to normal - LPC_SC->PCON =0x0; -} - -// "Brown-out Reduced Power mode" -void steven_BOGD_PowerDown(void) -{ - LPC_SC->PCON=0x1d; // PM1=0, PM0=1, enter power down mode if the SLEEPDEEP bit in SCR is 1; BOGD - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - __WFI(); -} - \ No newline at end of file