Chapter 2. API Reference
uint64_t esp_sleep_get_ext1_wakeup_status(void)
Get the bit mask of GPIOs which caused wakeup (ext1)
If wakeup was caused by another source, this function will return 0.
Return bit mask, if GPIOn caused wakeup, BIT(n) will be set
esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t
Set power down mode for an RTC power domain in sleep mode.
If not set set using this API, all power domains default to ESP_PD_OPTION_AUTO.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if either of the arguments is out of range
Parameters
• domain: power domain to configure
• option:
ESP_PD_OPTION_AUTO)
void esp_deep_sleep_start(void)
Enter deep sleep with the configured wakeup options.
This function does not return.
esp_err_t
esp_light_sleep_start(void)
Enter light sleep with the configured wakeup options.
Return
• ESP_OK on success (returned after wakeup)
• ESP_ERR_INVALID_STATE if WiFi or BT is not stopped
void esp_deep_sleep(uint64_t time_in_us)
Enter deep-sleep mode.
The device will automatically wake up after the deep-sleep time Upon waking up, the device calls deep sleep
wake stub, and then proceeds to load application.
Call to this function is equivalent to a call to esp_deep_sleep_enable_timer_wakeup followed by a call to
esp_deep_sleep_start.
esp_deep_sleep does not shut down WiFi, BT, and higher level protocol connections gracefully. Make sure
relevant WiFi and BT stack functions are called to close any connections and deinitialize the peripherals. These
include:
• esp_bluedroid_disable
• esp_bt_controller_disable
• esp_wifi_stop
This function does not return.
Note The device will wake up immediately if the deep-sleep time is set to 0
Parameters
• time_in_us: deep-sleep time, unit: microsecond
esp_sleep_wakeup_cause_t
Get the wakeup source which caused wakeup from sleep.
Return cause of wake up from last sleep (deep sleep or light sleep)
void esp_wake_deep_sleep(void)
Default stub to run on wake from deep sleep.
Allows for executing code immediately on wake from sleep, before the software bootloader or ESP-IDF app
has started up.
This function is weak-linked, so you can implement your own version to run code immediately when the chip
wakes from sleep.
Espressif Systems
power down option (ESP_PD_OPTION_OFF, ESP_PD_OPTION_ON, or
esp_sleep_get_wakeup_cause(void)
Submit Document Feedback
domain,
esp_sleep_pd_option_t
1044
option)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?