ASIF AHMAD
/
cortexm0sleepmodes
sleep library for cortex m0
Diff: pmu.h
- Revision:
- 0:e8a124690cda
diff -r 000000000000 -r e8a124690cda pmu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pmu.h Fri Sep 27 18:13:20 2013 +0000 @@ -0,0 +1,69 @@ +/**************************************************************************/ +/*! + @file pmu.c + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, K. Townsend (microBuilder.eu) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/**************************************************************************/ +#ifndef __PMU_H__ +#define __PMU_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "projectconfig.h" + +#define MCU_SLEEP (0) +#define MCU_DEEP_SLEEP (1) +#define MCU_POWER_DOWN (2) + +#define NVIC_LP_SEVONPEND (0x10) +#define NVIC_LP_SLEEPDEEP (0x04) +#define NVIC_LP_SLEEPONEXIT (0x02) + +#define IRC_OUT_PD (0x1<<0) +#define IRC_PD (0x1<<1) +#define FLASH_PD (0x1<<2) +#define BOD_PD (0x1<<3) +#define ADC_PD (0x1<<4) +#define SYS_OSC_PD (0x1<<5) +#define WDT_OSC_PD (0x1<<6) +#define SYS_PLL_PD (0x1<<7) +#define USBPLL_PD (0x1<<8) +#define USBPAD_PD (0x1<<10) + +void PMU_Sleep( uint32_t SleepMode, uint32_t SleepCtrl ); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file