File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
samples/boards/espressif/deep_sleep Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1
- # Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
1
+ # Copyright (c) 2022-2025 Espressif Systems (Shanghai) Co., Ltd.
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
4
4
mainmenu "Espressif Deep Sleep demo"
@@ -8,11 +8,12 @@ config EXAMPLE_EXT1_WAKEUP
8
8
depends on !SOC_SERIES_ESP32C3
9
9
select GPIO
10
10
help
11
- This option enables wake-up from deep sleep using GPIO2 and
12
- GPIO4. The sample enables internal pull-down on EXT1 pins to
13
- avoid random wake-ups. Otherwise, external pull-down should
14
- be used for the same purpose. To trigger a wake-up, connect
15
- one or both of the pins to HIGH.
11
+ This option enables wake-up from deep sleep using RTC IO
12
+ pins. On targets which support internal pull resistors for
13
+ RTC IOs, the sample enables internal pull-down on EXT1 pins
14
+ to avoid spurious wake-ups. On targets without this hardware
15
+ feature, external pull-down resistors should be used instead.
16
+ To trigger a wake-up, connect one or both of the pins to HIGH.
16
17
17
18
config EXAMPLE_GPIO_WAKEUP
18
19
bool "Enable wakeup from GPIO"
Original file line number Diff line number Diff line change 7
7
#include <zephyr/drivers/gpio.h>
8
8
#include <zephyr/sys/poweroff.h>
9
9
#include <esp_sleep.h>
10
+ #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
10
11
#include <driver/rtc_io.h>
12
+ #endif
11
13
12
14
#include <esp_attr.h>
13
15
14
16
#ifdef CONFIG_EXAMPLE_EXT1_WAKEUP
17
+ #ifdef CONFIG_SOC_SERIES_ESP32H2
18
+ #define EXT_WAKEUP_PIN_1 (10)
19
+ #define EXT_WAKEUP_PIN_2 (11)
20
+ #else
15
21
#define EXT_WAKEUP_PIN_1 (2)
16
22
#define EXT_WAKEUP_PIN_2 (4)
17
23
#endif
24
+ #endif
18
25
19
26
#ifdef CONFIG_EXAMPLE_GPIO_WAKEUP
20
27
#if !DT_NODE_HAS_STATUS_OKAY (DT_ALIAS (wakeup_button ))
@@ -90,11 +97,13 @@ int main(void)
90
97
esp_sleep_enable_ext1_wakeup (ext_wakeup_pin_1_mask | ext_wakeup_pin_2_mask ,
91
98
ESP_EXT1_WAKEUP_ANY_HIGH );
92
99
100
+ #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
93
101
/* enable pull-down on ext1 pins to avoid random wake-ups */
94
102
rtc_gpio_pullup_dis (EXT_WAKEUP_PIN_1 );
95
103
rtc_gpio_pulldown_en (EXT_WAKEUP_PIN_1 );
96
104
rtc_gpio_pullup_dis (EXT_WAKEUP_PIN_2 );
97
105
rtc_gpio_pulldown_en (EXT_WAKEUP_PIN_2 );
106
+ #endif
98
107
#endif /* CONFIG_EXAMPLE_EXT1_WAKEUP */
99
108
#ifdef CONFIG_EXAMPLE_GPIO_WAKEUP
100
109
if (!gpio_is_ready_dt (& wakeup_button )) {
You can’t perform that action at this time.
0 commit comments