From 1cfd65f8c4bc26bc3a68c2d5b21be84c1a0fd1ae Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Sat, 16 Jan 2021 16:53:43 +1100 Subject: [PATCH] examples: Update deep sleep example for ESP32-C3 --- examples/system/deep_sleep/main/Kconfig.projbuild | 3 +++ .../deep_sleep/main/deep_sleep_example_main.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/examples/system/deep_sleep/main/Kconfig.projbuild b/examples/system/deep_sleep/main/Kconfig.projbuild index b8027878dc..98edb9769c 100644 --- a/examples/system/deep_sleep/main/Kconfig.projbuild +++ b/examples/system/deep_sleep/main/Kconfig.projbuild @@ -3,6 +3,7 @@ menu "Example Configuration" config EXAMPLE_TOUCH_WAKEUP bool "Enable touch wake up" default y + depends on !IDF_TARGET_ESP32C3 help This option enables wake up from deep sleep using touch pads TOUCH8 and TOUCH9, which correspond to GPIO33 and GPIO32. @@ -10,6 +11,7 @@ menu "Example Configuration" config EXAMPLE_ULP_TEMPERATURE_WAKEUP bool "Enable temperature monitoring by ULP" default y + depends on IDF_TARGET_ESP32 help This option enables wake up from deep sleep using ULP. ULP program monitors the on-chip temperature sensor and @@ -20,6 +22,7 @@ menu "Example Configuration" config EXAMPLE_EXT1_WAKEUP bool "Enable wakeup from GPIO" default y + depends on !IDF_TARGET_ESP32C3 help This option enables wake up from deep sleep from GPIO2 and GPIO4. They should be connected to LOW to avoid floating pins. When triggering a wake up, connect one or both of the pins to HIGH. Note that floating diff --git a/examples/system/deep_sleep/main/deep_sleep_example_main.c b/examples/system/deep_sleep/main/deep_sleep_example_main.c index f406b6e7de..035d0439b9 100644 --- a/examples/system/deep_sleep/main/deep_sleep_example_main.c +++ b/examples/system/deep_sleep/main/deep_sleep_example_main.c @@ -12,17 +12,25 @@ #include #include #include +#include "sdkconfig.h" +#include "soc/soc_caps.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_sleep.h" #include "esp_log.h" -#include "esp32/ulp.h" -#include "driver/touch_pad.h" #include "driver/adc.h" #include "driver/rtc_io.h" -#include "soc/sens_periph.h" #include "soc/rtc.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/ulp.h" +#endif + +#if SOC_TOUCH_SENSOR_NUM > 0 +#include "soc/sens_periph.h" +#include "driver/touch_pad.h" +#endif + static RTC_DATA_ATTR struct timeval sleep_enter_time; #ifdef CONFIG_EXAMPLE_ULP_TEMPERATURE_WAKEUP