Merge branch 'feat/touch_sleep_esp32s31' into 'master'

feat(touch): support touch sleep on ESP32-S31

Closes IDF-15566 and IDF-14796

See merge request espressif/esp-idf!48443
This commit is contained in:
Hu Rui
2026-05-19 11:24:01 +08:00
6 changed files with 21 additions and 4 deletions
@@ -1197,7 +1197,7 @@ config SOC_TOUCH_MAX_CHAN_ID
config SOC_TOUCH_SUPPORT_SLEEP_WAKEUP config SOC_TOUCH_SUPPORT_SLEEP_WAKEUP
bool bool
default n default y
config SOC_TOUCH_SUPPORT_BENCHMARK config SOC_TOUCH_SUPPORT_BENCHMARK
bool bool
@@ -471,7 +471,7 @@
#define SOC_TOUCH_MAX_CHAN_ID (13) /*!< Touch maximum channel number */ #define SOC_TOUCH_MAX_CHAN_ID (13) /*!< Touch maximum channel number */
/* Touch Sensor Features */ /* Touch Sensor Features */
#define SOC_TOUCH_SUPPORT_SLEEP_WAKEUP (0) /*!< Touch sensor supports sleep awake */ #define SOC_TOUCH_SUPPORT_SLEEP_WAKEUP (1) /*!< Touch sensor supports sleep awake */
#define SOC_TOUCH_SUPPORT_BENCHMARK (1) /*!< Touch sensor supports benchmark configuration */ #define SOC_TOUCH_SUPPORT_BENCHMARK (1) /*!< Touch sensor supports benchmark configuration */
#define SOC_TOUCH_SUPPORT_WATERPROOF (1) /*!< Touch sensor supports waterproof */ #define SOC_TOUCH_SUPPORT_WATERPROOF (1) /*!< Touch sensor supports waterproof */
#define SOC_TOUCH_SUPPORT_PROX_SENSING (1) /*!< Touch sensor supports proximity sensing */ #define SOC_TOUCH_SUPPORT_PROX_SENSING (1) /*!< Touch sensor supports proximity sensing */
@@ -446,6 +446,12 @@ Call :cpp:func:`touch_channel_read_data` to read the data with different types.
// Register the deep sleep wake-up // Register the deep sleep wake-up
ESP_ERROR_CHECK(touch_sensor_config_sleep_wakeup(sens_handle, &deep_slp_cfg)); ESP_ERROR_CHECK(touch_sensor_config_sleep_wakeup(sens_handle, &deep_slp_cfg));
.. only:: esp32s31
.. note::
ESP32-S31 touch sensor wake-up from deep sleep may fail in some cases. Increasing ``meas_interval_us`` in :cpp:type:`touch_sensor_config_t` can help mitigate this issue.
.. only:: SOC_TOUCH_SUPPORT_DENOISE_CHAN .. only:: SOC_TOUCH_SUPPORT_DENOISE_CHAN
.. _touch-denoise-chan: .. _touch-denoise-chan:
@@ -446,6 +446,12 @@
// 注册 Deep-sleep 唤醒功能 // 注册 Deep-sleep 唤醒功能
ESP_ERROR_CHECK(touch_sensor_config_sleep_wakeup(sens_handle, &deep_slp_cfg)); ESP_ERROR_CHECK(touch_sensor_config_sleep_wakeup(sens_handle, &deep_slp_cfg));
.. only:: esp32s31
.. note::
ESP32-S31 触摸传感器从 Deep-sleep 唤醒在部分场景下可能失败。增大 :cpp:type:`touch_sensor_config_t` 中的 ``meas_interval_us`` 可缓解该问题。
.. only:: SOC_TOUCH_SUPPORT_DENOISE_CHAN .. only:: SOC_TOUCH_SUPPORT_DENOISE_CHAN
.. _touch-denoise-chan: .. _touch-denoise-chan:
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-P4 | ESP32-S2 | ESP32-S3 | | Supported Targets | ESP32 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 |
| ----------------- | ----- | -------- | -------- | -------- | | ----------------- | ----- | -------- | -------- | -------- | --------- |
# Touch Sensor Sleep Wake up Example # Touch Sensor Sleep Wake up Example
@@ -93,3 +93,7 @@ Entering deep sleep in:
## Troubleshooting ## Troubleshooting
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
## Known issues
The ESP32-S31 touch sensor may fail to wake the chip from deep sleep. Increasing `meas_interval_us` in `touch_sensor_config_t` can mitigate this issue.
@@ -10,6 +10,7 @@ menu "Example Configuration"
bool "Light sleep wakeup" bool "Light sleep wakeup"
config EXAMPLE_TOUCH_DEEP_SLEEP_WAKEUP config EXAMPLE_TOUCH_DEEP_SLEEP_WAKEUP
bool "Deep sleep wakeup" bool "Deep sleep wakeup"
depends on !IDF_TARGET_ESP32S31 # TODO: DIG-826
endchoice endchoice
config EXAMPLE_TOUCH_DEEP_SLEEP_PD config EXAMPLE_TOUCH_DEEP_SLEEP_PD