EFM32 Gecko Software Documentation  efm32g-doc-4.2.1
sleep.h
Go to the documentation of this file.
1 /***************************************************************************/
32 #ifndef __SLEEP_H
33 #define __SLEEP_H
34 
35 #include <stdint.h>
36 #include <stdbool.h>
37 
38 /* Device specific header file(s). */
39 #include "em_device.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /***************************************************************************/
50 /***************************************************************************/
64 /*******************************************************************************
65  ******************************* MACROS ************************************
66  ******************************************************************************/
67 
68 
69 /*******************************************************************************
70  **************************** CONFIGURATION ********************************
71  ******************************************************************************/
72 
75 #ifndef SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED
76 #define SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED true
77 #endif
78 
80 #ifndef SLEEP_EM4_WAKEUP_CALLBACK_ENABLED
81 #define SLEEP_EM4_WAKEUP_CALLBACK_ENABLED true
82 #endif
83 
90 #ifndef SLEEP_LOWEST_ENERGY_MODE_DEFAULT
91 #define SLEEP_LOWEST_ENERGY_MODE_DEFAULT sleepEM3
92 #endif
93 
94 /*******************************************************************************
95  ****************************** TYPEDEFS ***********************************
96  ******************************************************************************/
97 
99 typedef enum
100 {
102  sleepEM0 = 0,
103 
105  sleepEM1 = 1,
106 
108  sleepEM2 = 2,
109 
111  sleepEM3 = 3,
112 
116 
119 
120 
121 /*******************************************************************************
122  ****************************** PROTOTYPES *********************************
123  ******************************************************************************/
124 
125 /***************************************************************************/
144 void SLEEP_Init(SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb);
145 
146 /***************************************************************************/
162 
163 /***************************************************************************/
183 
184 
185 /***************************************************************************/
198 void SLEEP_ForceSleepInEM4(void);
199 
200 
201 /***************************************************************************/
227 
228 
229 /***************************************************************************/
257 
258 
262 #ifdef __cplusplus
263 }
264 #endif
265 #endif /* __SLEEP_H */
void SLEEP_SleepBlockEnd(SLEEP_EnergyMode_t eMode)
End sleep block in the requested energy mode.
Definition: sleep.c:299
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
void SLEEP_SleepBlockBegin(SLEEP_EnergyMode_t eMode)
Begin sleep block in the requested energy mode.
Definition: sleep.c:255
void SLEEP_Init(SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb)
Initialize the Sleep module.
Definition: sleep.c:137
SLEEP_EnergyMode_t
Definition: sleep.h:99
SLEEP_EnergyMode_t SLEEP_Sleep(void)
Sets the system to sleep into the lowest possible energy mode.
Definition: sleep.c:183
void(* SLEEP_CbFuncPtr_t)(SLEEP_EnergyMode_t)
Definition: sleep.h:118
void SLEEP_ForceSleepInEM4(void)
Force the device to go to EM4 without doing any checks.
Definition: sleep.c:219
SLEEP_EnergyMode_t SLEEP_LowestEnergyModeGet(void)
Gets the lowest energy mode that the system is allowed to be set to.
Definition: sleep.c:333