8static const char *
const TAG =
"deep_sleep";
12 esp_sleep_wakeup_cause_t wakeup_cause = esp_sleep_get_wakeup_cause();
13 switch (wakeup_cause) {
14 case ESP_SLEEP_WAKEUP_EXT0:
15 case ESP_SLEEP_WAKEUP_EXT1:
16 case ESP_SLEEP_WAKEUP_GPIO:
18 case ESP_SLEEP_WAKEUP_TOUCHPAD:
31#if !defined(USE_ESP32_VARIANT_ESP32C3) && !defined(USE_ESP32_VARIANT_ESP32C6)
34#if !defined(USE_ESP32_VARIANT_ESP32H2)
49 ESP_LOGCONFIG(TAG,
" Default Wakeup Run Duration: %" PRIu32
" ms",
62 ESP_LOGW(TAG,
"Waiting wakeup pin state change to enter deep sleep...");
71#if !defined(USE_ESP32_VARIANT_ESP32C3) && !defined(USE_ESP32_VARIANT_ESP32C6) && !defined(USE_ESP32_VARIANT_ESP32H2)
82 esp_sleep_enable_ext1_wakeup(this->
ext1_wakeup_->mask, this->ext1_wakeup_->wakeup_mode);
86 esp_sleep_enable_touchpad_wakeup();
87 esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
91#if defined(USE_ESP32_VARIANT_ESP32H2)
95 esp_sleep_enable_ext1_wakeup(this->
ext1_wakeup_->mask, this->ext1_wakeup_->wakeup_mode);
99#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6)
108 static_cast<esp_deepsleep_gpio_wake_up_mode_t
>(level));
111 esp_deep_sleep_start();
void status_set_warning(const char *message="unspecified")
virtual bool digital_read()=0
virtual uint8_t get_pin() const =0
virtual bool is_inverted() const =0
WakeupPinMode wakeup_pin_mode_
void set_run_duration(WakeupCauseToRunDuration wakeup_cause_to_run_duration)
void set_touch_wakeup(bool touch_wakeup)
InternalGPIOPin * wakeup_pin_
optional< Ext1Wakeup > ext1_wakeup_
optional< bool > touch_wakeup_
optional< uint64_t > sleep_duration_
optional< uint32_t > get_run_duration_() const
void set_wakeup_pin_mode(WakeupPinMode wakeup_pin_mode)
bool next_enter_deep_sleep_
optional< uint32_t > run_duration_
void dump_config_platform_()
void set_ext1_wakeup(Ext1Wakeup ext1_wakeup)
optional< WakeupCauseToRunDuration > wakeup_cause_to_run_duration_
WakeupPinMode
The values of this enum define what should be done if deep sleep is set up with a wakeup pin on the E...
@ WAKEUP_PIN_MODE_KEEP_AWAKE
As long as the wakeup pin is still in the wakeup state, keep awake.
@ WAKEUP_PIN_MODE_INVERT_WAKEUP
Automatically invert the wakeup level.
Providing packet encoding functions for exchanging data with a remote host.