sleep.h

Go to the documentation of this file.
00001 /***************************************************************************/
00032 #ifndef __SLEEP_H
00033 #define __SLEEP_H
00034 
00035 #include <stdint.h>
00036 #include <stdbool.h>
00037 
00038 /* Device specific header file(s). */
00039 #include "em_device.h"
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 /***************************************************************************/
00050 /***************************************************************************/
00064 /*******************************************************************************
00065  *******************************   MACROS   ************************************
00066  ******************************************************************************/
00067 
00068 
00069 /*******************************************************************************
00070  ****************************   CONFIGURATION   ********************************
00071  ******************************************************************************/
00072 
00075 #ifndef SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED
00076 #define SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED    true
00077 #endif
00078 
00080 #ifndef SLEEP_EM4_WAKEUP_CALLBACK_ENABLED
00081 #define SLEEP_EM4_WAKEUP_CALLBACK_ENABLED    true
00082 #endif
00083 
00090 #ifndef SLEEP_LOWEST_ENERGY_MODE_DEFAULT
00091 #define SLEEP_LOWEST_ENERGY_MODE_DEFAULT    sleepEM3
00092 #endif
00093 
00094 /*******************************************************************************
00095  ******************************   TYPEDEFS   ***********************************
00096  ******************************************************************************/
00097 
00099 typedef enum
00100 {
00102   sleepEM0 = 0,
00103 
00105   sleepEM1 = 1,
00106 
00108   sleepEM2 = 2,
00109 
00111   sleepEM3 = 3,
00112 
00114   sleepEM4 = 4
00115 } SLEEP_EnergyMode_t;
00116 
00118 typedef void (*SLEEP_CbFuncPtr_t)(SLEEP_EnergyMode_t);
00119 
00120 
00121 /*******************************************************************************
00122  ******************************   PROTOTYPES   *********************************
00123  ******************************************************************************/
00124 
00125 /***************************************************************************/
00144 void SLEEP_Init(SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb);
00145 
00146 /***************************************************************************/
00161 SLEEP_EnergyMode_t SLEEP_LowestEnergyModeGet(void);
00162 
00163 /***************************************************************************/
00182 SLEEP_EnergyMode_t SLEEP_Sleep(void);
00183 
00184 
00185 /***************************************************************************/
00198 void SLEEP_ForceSleepInEM4(void);
00199 
00200 
00201 /***************************************************************************/
00226 void SLEEP_SleepBlockBegin(SLEEP_EnergyMode_t eMode);
00227 
00228 
00229 /***************************************************************************/
00256 void SLEEP_SleepBlockEnd(SLEEP_EnergyMode_t eMode);
00257 
00258 
00262 #ifdef __cplusplus
00263 }
00264 #endif
00265 #endif /* __SLEEP_H */