EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
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  **************************** CONFIGURATION ********************************
70  ******************************************************************************/
71 
74 #ifndef SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED
75 #define SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED true
76 #endif
77 
79 #ifndef SLEEP_EM4_WAKEUP_CALLBACK_ENABLED
80 #define SLEEP_EM4_WAKEUP_CALLBACK_ENABLED true
81 #endif
82 
89 #ifndef SLEEP_LOWEST_ENERGY_MODE_DEFAULT
90 #define SLEEP_LOWEST_ENERGY_MODE_DEFAULT sleepEM3
91 #endif
92 
93 /*******************************************************************************
94  ****************************** TYPEDEFS ***********************************
95  ******************************************************************************/
96 
98 typedef enum
99 {
101  sleepEM0 = 0,
102 
104  sleepEM1 = 1,
105 
107  sleepEM2 = 2,
108 
110  sleepEM3 = 3,
111 
115 
118 
119 /*******************************************************************************
120  ****************************** PROTOTYPES *********************************
121  ******************************************************************************/
122 
123 /***************************************************************************/
142 void SLEEP_Init(SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb);
143 
144 /***************************************************************************/
158 
159 /***************************************************************************/
177 
178 /***************************************************************************/
191 void SLEEP_ForceSleepInEM4(void);
192 
193 /***************************************************************************/
218 
219 /***************************************************************************/
246 
250 #ifdef __cplusplus
251 }
252 #endif
253 #endif /* SLEEP_H */
void SLEEP_SleepBlockEnd(SLEEP_EnergyMode_t eMode)
End sleep block in the requested energy mode.
Definition: sleep.c:295
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:249
void SLEEP_Init(SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb)
Initialize the Sleep module.
Definition: sleep.c:131
SLEEP_EnergyMode_t
Definition: sleep.h:98
SLEEP_EnergyMode_t SLEEP_Sleep(void)
Sets the system to sleep into the lowest possible energy mode.
Definition: sleep.c:179
void(* SLEEP_CbFuncPtr_t)(SLEEP_EnergyMode_t)
Definition: sleep.h:117
void SLEEP_ForceSleepInEM4(void)
Force the device to go to EM4 without doing any checks.
Definition: sleep.c:214
SLEEP_EnergyMode_t SLEEP_LowestEnergyModeGet(void)
Gets the lowest energy mode that the system is allowed to be set to.
Definition: sleep.c:331