ASIF AHMAD
/
cortexm0sleepmode
sleep library for cortex m0
Fork of cortexm0sleepmodes by
pmu.h@0:e8a124690cda, 2013-09-27 (annotated)
- Committer:
- asifahmad
- Date:
- Fri Sep 27 18:13:20 2013 +0000
- Revision:
- 0:e8a124690cda
sleep
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asifahmad | 0:e8a124690cda | 1 | /**************************************************************************/ |
asifahmad | 0:e8a124690cda | 2 | /*! |
asifahmad | 0:e8a124690cda | 3 | @file pmu.c |
asifahmad | 0:e8a124690cda | 4 | |
asifahmad | 0:e8a124690cda | 5 | @section LICENSE |
asifahmad | 0:e8a124690cda | 6 | |
asifahmad | 0:e8a124690cda | 7 | Software License Agreement (BSD License) |
asifahmad | 0:e8a124690cda | 8 | |
asifahmad | 0:e8a124690cda | 9 | Copyright (c) 2013, K. Townsend (microBuilder.eu) |
asifahmad | 0:e8a124690cda | 10 | All rights reserved. |
asifahmad | 0:e8a124690cda | 11 | |
asifahmad | 0:e8a124690cda | 12 | Redistribution and use in source and binary forms, with or without |
asifahmad | 0:e8a124690cda | 13 | modification, are permitted provided that the following conditions are met: |
asifahmad | 0:e8a124690cda | 14 | 1. Redistributions of source code must retain the above copyright |
asifahmad | 0:e8a124690cda | 15 | notice, this list of conditions and the following disclaimer. |
asifahmad | 0:e8a124690cda | 16 | 2. Redistributions in binary form must reproduce the above copyright |
asifahmad | 0:e8a124690cda | 17 | notice, this list of conditions and the following disclaimer in the |
asifahmad | 0:e8a124690cda | 18 | documentation and/or other materials provided with the distribution. |
asifahmad | 0:e8a124690cda | 19 | 3. Neither the name of the copyright holders nor the |
asifahmad | 0:e8a124690cda | 20 | names of its contributors may be used to endorse or promote products |
asifahmad | 0:e8a124690cda | 21 | derived from this software without specific prior written permission. |
asifahmad | 0:e8a124690cda | 22 | |
asifahmad | 0:e8a124690cda | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
asifahmad | 0:e8a124690cda | 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
asifahmad | 0:e8a124690cda | 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
asifahmad | 0:e8a124690cda | 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY |
asifahmad | 0:e8a124690cda | 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
asifahmad | 0:e8a124690cda | 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
asifahmad | 0:e8a124690cda | 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
asifahmad | 0:e8a124690cda | 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
asifahmad | 0:e8a124690cda | 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
asifahmad | 0:e8a124690cda | 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
asifahmad | 0:e8a124690cda | 33 | */ |
asifahmad | 0:e8a124690cda | 34 | /**************************************************************************/ |
asifahmad | 0:e8a124690cda | 35 | #ifndef __PMU_H__ |
asifahmad | 0:e8a124690cda | 36 | #define __PMU_H__ |
asifahmad | 0:e8a124690cda | 37 | |
asifahmad | 0:e8a124690cda | 38 | #ifdef __cplusplus |
asifahmad | 0:e8a124690cda | 39 | extern "C" { |
asifahmad | 0:e8a124690cda | 40 | #endif |
asifahmad | 0:e8a124690cda | 41 | |
asifahmad | 0:e8a124690cda | 42 | #include "projectconfig.h" |
asifahmad | 0:e8a124690cda | 43 | |
asifahmad | 0:e8a124690cda | 44 | #define MCU_SLEEP (0) |
asifahmad | 0:e8a124690cda | 45 | #define MCU_DEEP_SLEEP (1) |
asifahmad | 0:e8a124690cda | 46 | #define MCU_POWER_DOWN (2) |
asifahmad | 0:e8a124690cda | 47 | |
asifahmad | 0:e8a124690cda | 48 | #define NVIC_LP_SEVONPEND (0x10) |
asifahmad | 0:e8a124690cda | 49 | #define NVIC_LP_SLEEPDEEP (0x04) |
asifahmad | 0:e8a124690cda | 50 | #define NVIC_LP_SLEEPONEXIT (0x02) |
asifahmad | 0:e8a124690cda | 51 | |
asifahmad | 0:e8a124690cda | 52 | #define IRC_OUT_PD (0x1<<0) |
asifahmad | 0:e8a124690cda | 53 | #define IRC_PD (0x1<<1) |
asifahmad | 0:e8a124690cda | 54 | #define FLASH_PD (0x1<<2) |
asifahmad | 0:e8a124690cda | 55 | #define BOD_PD (0x1<<3) |
asifahmad | 0:e8a124690cda | 56 | #define ADC_PD (0x1<<4) |
asifahmad | 0:e8a124690cda | 57 | #define SYS_OSC_PD (0x1<<5) |
asifahmad | 0:e8a124690cda | 58 | #define WDT_OSC_PD (0x1<<6) |
asifahmad | 0:e8a124690cda | 59 | #define SYS_PLL_PD (0x1<<7) |
asifahmad | 0:e8a124690cda | 60 | #define USBPLL_PD (0x1<<8) |
asifahmad | 0:e8a124690cda | 61 | #define USBPAD_PD (0x1<<10) |
asifahmad | 0:e8a124690cda | 62 | |
asifahmad | 0:e8a124690cda | 63 | void PMU_Sleep( uint32_t SleepMode, uint32_t SleepCtrl ); |
asifahmad | 0:e8a124690cda | 64 | |
asifahmad | 0:e8a124690cda | 65 | #ifdef __cplusplus |
asifahmad | 0:e8a124690cda | 66 | } |
asifahmad | 0:e8a124690cda | 67 | #endif |
asifahmad | 0:e8a124690cda | 68 | |
asifahmad | 0:e8a124690cda | 69 | #endif |