00001 /***************************************************************************/ 00051 #ifndef __SLEEP_H 00052 #define __SLEEP_H 00053 00054 #include <stdint.h> 00055 #include <stdbool.h> 00056 00057 /* Device specific header file(s). */ 00058 #include "em_device.h" 00059 00060 #ifdef __cplusplus 00061 extern "C" { 00062 #endif 00063 00064 /***************************************************************************/ 00069 /***************************************************************************/ 00083 /******************************************************************************* 00084 ******************************* MACROS ************************************ 00085 ******************************************************************************/ 00086 00087 00088 /******************************************************************************* 00089 **************************** CONFIGURATION ******************************** 00090 ******************************************************************************/ 00091 00094 #ifndef SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED 00095 #define SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED true 00096 #endif 00097 00099 #ifndef SLEEP_EM4_WAKEUP_CALLBACK_ENABLED 00100 #define SLEEP_EM4_WAKEUP_CALLBACK_ENABLED true 00101 #endif 00102 00109 #ifndef SLEEP_LOWEST_ENERGY_MODE_DEFAULT 00110 #define SLEEP_LOWEST_ENERGY_MODE_DEFAULT sleepEM3 00111 #endif 00112 00113 /******************************************************************************* 00114 ****************************** TYPEDEFS *********************************** 00115 ******************************************************************************/ 00116 00118 typedef enum 00119 { 00121 sleepEM0 = 0, 00122 00124 sleepEM1 = 1, 00125 00127 sleepEM2 = 2, 00128 00130 sleepEM3 = 3, 00131 00133 sleepEM4 = 4 00134 } SLEEP_EnergyMode_t; 00135 00137 typedef void (*SLEEP_CbFuncPtr_t)(SLEEP_EnergyMode_t); 00138 00139 00140 /******************************************************************************* 00141 ****************************** PROTOTYPES ********************************* 00142 ******************************************************************************/ 00143 00144 /***************************************************************************/ 00163 void SLEEP_Init(SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb); 00164 00165 00166 /***************************************************************************/ 00185 SLEEP_EnergyMode_t SLEEP_Sleep(void); 00186 00187 00188 /***************************************************************************/ 00201 void SLEEP_ForceSleepInEM4(void); 00202 00203 00204 /***************************************************************************/ 00229 void SLEEP_SleepBlockBegin(SLEEP_EnergyMode_t eMode); 00230 00231 00232 /***************************************************************************/ 00259 void SLEEP_SleepBlockEnd(SLEEP_EnergyMode_t eMode); 00260 00261 00265 #ifdef __cplusplus 00266 } 00267 #endif 00268 #endif /* __SLEEP_H */