diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index 5c1de62755..c4c6e852be 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -84,28 +84,22 @@ if(CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2) list(APPEND srcs "spi_slave_hd.c") endif() +if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) + list(APPEND srcs "touch_sensor_common.c" "${target}/touch_sensor.c") +endif() + if(${target} STREQUAL "esp32") list(APPEND srcs "dac_common.c" "sdio_slave.c" - "touch_sensor_common.c" - "esp32/touch_sensor.c" "deprecated/adc_i2s_deprecated.c" "esp32/dac.c") endif() if(${target} STREQUAL "esp32s2") list(APPEND srcs "dac_common.c" - "touch_sensor_common.c" - "esp32s2/touch_sensor.c" "esp32s2/dac.c") endif() -if(${target} STREQUAL "esp32s3") - list(APPEND srcs "touch_sensor_common.c" - "esp32s3/touch_sensor.c") -endif() - - if(BOOTLOADER_BUILD) # Bootloader shall NOT depend on the drivers idf_component_register() diff --git a/components/driver/include/driver/touch_pad.h b/components/driver/include/driver/touch_pad.h index 0c2feebd8a..3730eb386d 100644 --- a/components/driver/include/driver/touch_pad.h +++ b/components/driver/include/driver/touch_pad.h @@ -6,4 +6,8 @@ #pragma once +#include "soc/soc_caps.h" + +#if SOC_TOUCH_SENSOR_SUPPORTED #include "driver/touch_sensor.h" +#endif diff --git a/components/esp_hw_support/include/esp_sleep.h b/components/esp_hw_support/include/esp_sleep.h index 21d0275d37..286ccc76de 100644 --- a/components/esp_hw_support/include/esp_sleep.h +++ b/components/esp_hw_support/include/esp_sleep.h @@ -129,8 +129,7 @@ esp_err_t esp_sleep_enable_ulp_wakeup(void); */ esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us); -#if SOC_TOUCH_SENSOR_NUM > 0 - +#if SOC_TOUCH_SENSOR_SUPPORTED /** * @brief Enable wakeup by touch sensor * @@ -157,8 +156,7 @@ esp_err_t esp_sleep_enable_touchpad_wakeup(void); * @return touch pad which caused wakeup */ touch_pad_t esp_sleep_get_touchpad_wakeup_status(void); - -#endif // SOC_TOUCH_SENSOR_NUM > 0 +#endif // SOC_TOUCH_SENSOR_SUPPORTED /** * @brief Returns true if a GPIO number is valid for use as wakeup source. @@ -360,7 +358,7 @@ uint64_t esp_sleep_get_gpio_wakeup_status(void); * - ESP_ERR_INVALID_ARG if either of the arguments is out of range */ esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain, - esp_sleep_pd_option_t option); + esp_sleep_pd_option_t option); /** * @brief Enter deep sleep with the configured wakeup options diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 14e606f3db..de7e676b26 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -32,7 +32,7 @@ #include "hal/wdt_hal.h" #include "hal/rtc_hal.h" #include "hal/uart_hal.h" -#if SOC_TOUCH_SENSOR_NUM > 0 +#if SOC_TOUCH_SENSOR_SUPPORTED #include "hal/touch_sensor_hal.h" #include "driver/touch_sensor.h" #include "driver/touch_sensor_common.h" @@ -899,7 +899,7 @@ static void touch_wakeup_prepare(void) } #endif -#if SOC_TOUCH_SENSOR_NUM > 0 +#if SOC_TOUCH_SENSOR_SUPPORTED esp_err_t esp_sleep_enable_touchpad_wakeup(void) { @@ -926,7 +926,7 @@ touch_pad_t esp_sleep_get_touchpad_wakeup_status(void) return (ret == ESP_OK) ? pad_num : TOUCH_PAD_MAX; } -#endif // SOC_TOUCH_SENSOR_NUM > 0 +#endif // SOC_TOUCH_SENSOR_SUPPORTED bool esp_sleep_is_valid_wakeup_gpio(gpio_num_t gpio_num) { diff --git a/components/soc/esp32/include/soc/Kconfig.soc_caps.in b/components/soc/esp32/include/soc/Kconfig.soc_caps.in index 1f1eccb076..a9183bdd61 100644 --- a/components/soc/esp32/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32/include/soc/Kconfig.soc_caps.in @@ -119,6 +119,10 @@ config SOC_SECURE_BOOT_SUPPORTED bool default y +config SOC_TOUCH_SENSOR_SUPPORTED + bool + default y + config SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL int default 5 diff --git a/components/soc/esp32/include/soc/soc_caps.h b/components/soc/esp32/include/soc/soc_caps.h index 6a8148f85d..9a20710ed2 100644 --- a/components/soc/esp32/include/soc/soc_caps.h +++ b/components/soc/esp32/include/soc/soc_caps.h @@ -89,6 +89,7 @@ #define SOC_SHA_SUPPORTED 1 #define SOC_FLASH_ENC_SUPPORTED 1 #define SOC_SECURE_BOOT_SUPPORTED 1 +#define SOC_TOUCH_SENSOR_SUPPORTED 1 #if SOC_CAPS_ECO_VER < 2 #define SOC_DPORT_WORKAROUND 1 diff --git a/components/soc/esp32/touch_sensor_periph.c b/components/soc/esp32/touch_sensor_periph.c index 910d774716..f9a86d81de 100644 --- a/components/soc/esp32/touch_sensor_periph.c +++ b/components/soc/esp32/touch_sensor_periph.c @@ -1,21 +1,13 @@ -// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "soc/touch_sensor_periph.h" /* Store IO number corresponding to the Touch Sensor channel number. */ -const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM] = { +const int touch_sensor_channel_io_map[] = { TOUCH_PAD_NUM0_GPIO_NUM, TOUCH_PAD_NUM1_GPIO_NUM, TOUCH_PAD_NUM2_GPIO_NUM, diff --git a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in index 50fc498e26..625e865801 100644 --- a/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c2/include/soc/Kconfig.soc_caps.in @@ -447,10 +447,6 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS int default 1 -config SOC_TOUCH_SENSOR_NUM - int - default 0 - config SOC_SECURE_BOOT_V2_ECC bool default y diff --git a/components/soc/esp32c2/include/soc/soc_caps.h b/components/soc/esp32c2/include/soc/soc_caps.h index f59babe4f5..b4d62ff916 100644 --- a/components/soc/esp32c2/include/soc/soc_caps.h +++ b/components/soc/esp32c2/include/soc/soc_caps.h @@ -220,9 +220,6 @@ #define SOC_TIMER_GROUP_SUPPORT_PLL_F40M (1) #define SOC_TIMER_GROUP_TOTAL_TIMERS (1U) -/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/ -#define SOC_TOUCH_SENSOR_NUM (0U) /*! No touch sensors on ESP32-C2 */ - /*-------------------------- Secure Boot CAPS----------------------------*/ #define SOC_SECURE_BOOT_V2_ECC 1 #define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS (1U) diff --git a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in index 51b306ba68..632ebae5e6 100644 --- a/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c3/include/soc/Kconfig.soc_caps.in @@ -659,10 +659,6 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS int default 2 -config SOC_TOUCH_SENSOR_NUM - bool - default n - config SOC_TWAI_BRP_MIN int default 2 diff --git a/components/soc/esp32c3/include/soc/soc_caps.h b/components/soc/esp32c3/include/soc/soc_caps.h index 6f89da7f65..fc3c967c85 100644 --- a/components/soc/esp32c3/include/soc/soc_caps.h +++ b/components/soc/esp32c3/include/soc/soc_caps.h @@ -305,9 +305,6 @@ #define SOC_TIMER_GROUP_SUPPORT_APB (1) #define SOC_TIMER_GROUP_TOTAL_TIMERS (2) -/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/ -#define SOC_TOUCH_SENSOR_NUM (0) /*! No touch sensors on ESP32-C3 */ - /*-------------------------- TWAI CAPS ---------------------------------------*/ #define SOC_TWAI_BRP_MIN 2 #define SOC_TWAI_BRP_MAX 16384 diff --git a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in index 68c47e1877..19d55d3879 100644 --- a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in @@ -635,10 +635,6 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS int default 2 -config SOC_TOUCH_SENSOR_NUM - bool - default n - config SOC_TWAI_BRP_MIN int default 2 diff --git a/components/soc/esp32h2/include/soc/soc_caps.h b/components/soc/esp32h2/include/soc/soc_caps.h index f1167d33dd..5e00fd8df0 100644 --- a/components/soc/esp32h2/include/soc/soc_caps.h +++ b/components/soc/esp32h2/include/soc/soc_caps.h @@ -310,9 +310,6 @@ #define SOC_TIMER_GROUP_SUPPORT_AHB (1) #define SOC_TIMER_GROUP_TOTAL_TIMERS (2) -/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/ -#define SOC_TOUCH_SENSOR_NUM (0) /*! No touch sensors on ESP32-H2 */ - /*-------------------------- TWAI CAPS ---------------------------------------*/ #define SOC_TWAI_BRP_MIN 2 #define SOC_TWAI_BRP_MAX 16384 diff --git a/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in index 1c93e77cfb..968fd1d2ee 100644 --- a/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s2/include/soc/Kconfig.soc_caps.in @@ -135,6 +135,10 @@ config SOC_MEMPROT_SUPPORTED bool default y +config SOC_TOUCH_SENSOR_SUPPORTED + bool + default y + config SOC_ADC_RTC_CTRL_SUPPORTED bool default y diff --git a/components/soc/esp32s2/include/soc/soc_caps.h b/components/soc/esp32s2/include/soc/soc_caps.h index ff543a7299..8faea632e6 100644 --- a/components/soc/esp32s2/include/soc/soc_caps.h +++ b/components/soc/esp32s2/include/soc/soc_caps.h @@ -72,6 +72,7 @@ #define SOC_FLASH_ENC_SUPPORTED 1 #define SOC_SECURE_BOOT_SUPPORTED 1 #define SOC_MEMPROT_SUPPORTED 1 +#define SOC_TOUCH_SENSOR_SUPPORTED 1 /*-------------------------- ADC CAPS ----------------------------------------*/ diff --git a/components/soc/esp32s2/touch_sensor_periph.c b/components/soc/esp32s2/touch_sensor_periph.c index 6f5284ec67..f9448a27c4 100644 --- a/components/soc/esp32s2/touch_sensor_periph.c +++ b/components/soc/esp32s2/touch_sensor_periph.c @@ -1,22 +1,14 @@ -// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "soc/touch_sensor_periph.h" /* Store IO number corresponding to the Touch Sensor channel number. */ /* Note: T0 is an internal channel that does not have a corresponding external GPIO. */ -const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM] = { +const int touch_sensor_channel_io_map[] = { -1, TOUCH_PAD_NUM1_GPIO_NUM, TOUCH_PAD_NUM2_GPIO_NUM, diff --git a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in index 6919e3e1e7..a1b241ccbb 100644 --- a/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s3/include/soc/Kconfig.soc_caps.in @@ -191,6 +191,10 @@ config SOC_MEMPROT_SUPPORTED bool default y +config SOC_TOUCH_SENSOR_SUPPORTED + bool + default y + config SOC_APPCPU_HAS_CLOCK_GATING_BUG bool default y diff --git a/components/soc/esp32s3/include/soc/soc_caps.h b/components/soc/esp32s3/include/soc/soc_caps.h index f898fdd87c..9ce7f92a23 100644 --- a/components/soc/esp32s3/include/soc/soc_caps.h +++ b/components/soc/esp32s3/include/soc/soc_caps.h @@ -62,7 +62,7 @@ #define SOC_FLASH_ENC_SUPPORTED 1 #define SOC_SECURE_BOOT_SUPPORTED 1 #define SOC_MEMPROT_SUPPORTED 1 - +#define SOC_TOUCH_SENSOR_SUPPORTED 1 /*-------------------------- SOC CAPS ----------------------------------------*/ #define SOC_APPCPU_HAS_CLOCK_GATING_BUG (1) diff --git a/components/soc/esp32s3/touch_sensor_periph.c b/components/soc/esp32s3/touch_sensor_periph.c index f9f4246ab1..0bf0a0b3b9 100644 --- a/components/soc/esp32s3/touch_sensor_periph.c +++ b/components/soc/esp32s3/touch_sensor_periph.c @@ -8,7 +8,7 @@ /* Store IO number corresponding to the Touch Sensor channel number. */ /* Note: T0 is an internal channel that does not have a corresponding external GPIO. */ -const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM] = { +const int touch_sensor_channel_io_map[] = { -1, TOUCH_PAD_NUM1_GPIO_NUM, TOUCH_PAD_NUM2_GPIO_NUM, diff --git a/components/soc/include/soc/touch_sensor_periph.h b/components/soc/include/soc/touch_sensor_periph.h index e38b18b059..2b27b97d20 100644 --- a/components/soc/include/soc/touch_sensor_periph.h +++ b/components/soc/include/soc/touch_sensor_periph.h @@ -1,16 +1,8 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -28,7 +20,7 @@ extern "C" { #endif -extern const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM]; +extern const int touch_sensor_channel_io_map[]; #ifdef __cplusplus } diff --git a/docs/conf_common.py b/docs/conf_common.py index 95e2db7512..a752816949 100644 --- a/docs/conf_common.py +++ b/docs/conf_common.py @@ -156,7 +156,7 @@ conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS, 'SOC_PCNT_SUPPORTED':PCNT_DOCS, 'SOC_RMT_SUPPORTED':RMT_DOCS, 'SOC_DAC_SUPPORTED':DAC_DOCS, - 'SOC_TOUCH_SENSOR_NUM':TOUCH_SENSOR_DOCS, + 'SOC_TOUCH_SENSOR_SUPPORTED':TOUCH_SENSOR_DOCS, 'SOC_ULP_SUPPORTED':ULP_DOCS, 'SOC_RISCV_COPROC_SUPPORTED':RISCV_COPROC_DOCS, 'SOC_DIG_SIGN_SUPPORTED':['api-reference/peripherals/ds.rst'], diff --git a/docs/en/api-reference/peripherals/index.rst b/docs/en/api-reference/peripherals/index.rst index c5141011f0..1acaff26f6 100644 --- a/docs/en/api-reference/peripherals/index.rst +++ b/docs/en/api-reference/peripherals/index.rst @@ -33,7 +33,7 @@ Peripherals API :esp32: secure_element :esp32s2: spi_slave_hd :SOC_TEMP_SENSOR_SUPPORTED: temp_sensor - :SOC_TOUCH_SENSOR_NUM: touch_pad + :SOC_TOUCH_SENSOR_SUPPORTED: touch_pad :esp32s2: touch_element :SOC_TWAI_SUPPORTED: twai uart diff --git a/docs/en/api-reference/system/sleep_modes.rst b/docs/en/api-reference/system/sleep_modes.rst index 72ea35a706..ace78939b7 100644 --- a/docs/en/api-reference/system/sleep_modes.rst +++ b/docs/en/api-reference/system/sleep_modes.rst @@ -181,7 +181,7 @@ So, in theory, it's ok if you only wake up the system after the flash is complet Therefore, it's recommended not to power down flash when using ESP-IDF. For power-sensitive applications, it's recommended to use Kconfig option :ref:`CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND` to reduce the power consumption of the flash during light sleep, instead of powering down the flash. .. only:: SOC_SPIRAM_SUPPORTED - + It is worth mentioning that PSRAM has a similar Kconfig option :ref:`CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND`. However, for those who have fully understood the risk and are still willing to power down the flash to further reduce the power consumption, please check the following mechanisms: @@ -243,7 +243,7 @@ Checking Sleep Wakeup Cause :cpp:func:`esp_sleep_get_wakeup_cause` function can be used to check which wakeup source has triggered wakeup from sleep mode. -.. only:: SOC_TOUCH_SENSOR_NUM +.. only:: SOC_TOUCH_SENSOR_SUPPORTED For touchpad, it is possible to identify which touch pin has caused wakeup using :cpp:func:`esp_sleep_get_touchpad_wakeup_status` functions. diff --git a/docs/zh_CN/api-reference/peripherals/index.rst b/docs/zh_CN/api-reference/peripherals/index.rst index 95040b7c8f..f388a2dd69 100644 --- a/docs/zh_CN/api-reference/peripherals/index.rst +++ b/docs/zh_CN/api-reference/peripherals/index.rst @@ -33,7 +33,7 @@ :esp32: secure_element :esp32s2: spi_slave_hd :SOC_TEMP_SENSOR_SUPPORTED: temp_sensor - :SOC_TOUCH_SENSOR_NUM: touch_pad + :SOC_TOUCH_SENSOR_SUPPORTED: touch_pad :esp32s2: touch_element :SOC_TWAI_SUPPORTED: twai uart diff --git a/docs/zh_CN/api-reference/system/sleep_modes.rst b/docs/zh_CN/api-reference/system/sleep_modes.rst index a489cc0217..f8b679a543 100644 --- a/docs/zh_CN/api-reference/system/sleep_modes.rst +++ b/docs/zh_CN/api-reference/system/sleep_modes.rst @@ -67,7 +67,7 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒 RTC IO 模块中包含这样一个逻辑——当发生触摸传感器中断时,触发唤醒。要启用此唤醒源,用户需要在芯片进入睡眠模式前配置触摸传感器中断功能。 .. only:: esp32 - + ESP32 修订版 0 和 1 仅在 RTC 外设没有被强制供电时支持该唤醒源(即 ESP_PD_DOMAIN_RTC_PERIPH 应被设置为 ESP_PD_OPTION_AUTO)。 可调用 :cpp:func:`esp_sleep_enable_touchpad_wakeup` 函数来启用该唤醒源。 @@ -78,7 +78,7 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒 ^^^^^^^^^^^^^^^^^^^^^^ RTC IO 模块中包含这样一个逻辑——当某个 RTC GPIO 被设置为预定义的逻辑值时,触发唤醒。RTC IO 是 RTC 外设电源域的一部分,因此如果该唤醒源被请求,RTC 外设将在 Deep-sleep 模式期间保持供电。 - + 在此模式下,RTC IO 模块被使能,因此也可以使用内部上拉或下拉电阻。配置时,应用程序需要在调用函数 :cpp:func:`esp_deep_sleep_start` 前先调用函数 :cpp:func:`rtc_gpio_pullup_en` 和 :cpp:func:`rtc_gpio_pulldown_en`。 .. only:: esp32 @@ -115,7 +115,7 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒 当芯片处于睡眠模式时,ULP 协处理器仍然运行,可用于轮询传感器、监视 ADC 或触摸传感器的值,并在检测到特殊事件时唤醒芯片。ULP 协处理器是 RTC 外设电源域的一部分,运行存储在 RTC 低速内存中的程序。如果这一唤醒源被请求,RTC 低速内存将会在睡眠期间保持供电状态。RTC 外设会在 ULP 协处理器开始运行程序前自动上电;一旦程序停止运行,RTC 外设会再次自动断电。 .. only:: esp32 - + ESP32 修订版 0 和 1 仅在 RTC 外设没有被强制供电时支持该唤醒(即 ESP_PD_DOMAIN_RTC_PERIPH 应被设置为 ESP_PD_OPTION_AUTO)。 可调用 :cpp:func:`esp_sleep_enable_ulp_wakeup` 函数来启用此唤醒源。 @@ -179,7 +179,7 @@ Flash 断电 因为这些不可控的因素,ESP-IDF 很难保证 flash断电的绝对安全。因此 ESP-IDF 不推荐用户断电 flash。对于一些功耗敏感型应用,可以通过设置 Kconfig 配置项 :ref:`CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND` 来减少 light sleep 期间 flash 的功耗。这种方式在几乎所有场景下都要比断电 flash 更好,兼顾了安全性和功耗。 .. only:: SOC_SPIRAM_SUPPORTED - + 值得一提的是,PSRAM 也有一个类似的 Kconfig 配置项 :ref:`CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND`。 考虑到有些用户能够充分评估断电 flash 的风险,并希望通过断电 flash 来获得更低的功耗,因此 ESP-IDF 提供了两种断电 flash 的机制: @@ -224,7 +224,7 @@ Flash 断电 .. only:: esp32c3 在 Deep-sleep 模式中: - - 数字 GPIO (GPIO6 ~ 21) 处于高阻态。 + - 数字 GPIO (GPIO6 ~ 21) 处于高阻态。 - RTC GPIO (GPIO0 ~ 5) 可能处于以下状态: - 如果未启用保持 (hold) 功能,RTC GPIO 将处于高阻态。 - 如果启用保持功能,RTC GPIO 管脚将会在保持功能开启时处于锁存状态。 @@ -241,7 +241,7 @@ UART 输出处理 :cpp:func:`esp_sleep_get_wakeup_cause` 函数可用于检测是何种唤醒源在睡眠期间被触发。 -.. only:: SOC_TOUCH_SENSOR_NUM +.. only:: SOC_TOUCH_SENSOR_SUPPORTED 对于触摸传感器唤醒源,可以调用函数 :cpp:func:`esp_sleep_get_touchpad_wakeup_status` 来确认触发唤醒的触摸管脚。 diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index 134372ba28..9845fe85fb 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -166,7 +166,7 @@ examples/peripherals/temp_sensor: examples/peripherals/touch_sensor: disable: - - if: SOC_TOUCH_SENSOR_NUM == 0 + - if: SOC_TOUCH_SENSOR_SUPPORTED != 1 examples/peripherals/touch_sensor/touch_element: enable: 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 e310b9e4d3..c4470bef05 100644 --- a/examples/system/deep_sleep/main/deep_sleep_example_main.c +++ b/examples/system/deep_sleep/main/deep_sleep_example_main.c @@ -21,7 +21,7 @@ #include "driver/rtc_io.h" #include "soc/rtc.h" -#if SOC_TOUCH_SENSOR_NUM > 0 +#if SOC_TOUCH_SENSOR_SUPPORTED #include "soc/sens_periph.h" #include "driver/touch_pad.h" #endif diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 58a716a605..8ef71faa20 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -1055,7 +1055,6 @@ components/soc/esp32/ledc_periph.c components/soc/esp32/sdio_slave_periph.c components/soc/esp32/sdmmc_periph.c components/soc/esp32/spi_periph.c -components/soc/esp32/touch_sensor_periph.c components/soc/esp32/uart_periph.c components/soc/esp32c3/i2c_bbpll.h components/soc/esp32c3/i2c_periph.c @@ -1218,7 +1217,6 @@ components/soc/esp32s2/include/soc/wdev_reg.h components/soc/esp32s2/interrupts.c components/soc/esp32s2/ledc_periph.c components/soc/esp32s2/spi_periph.c -components/soc/esp32s2/touch_sensor_periph.c components/soc/esp32s2/uart_periph.c components/soc/esp32s2/usb_periph.c components/soc/esp32s3/dedic_gpio_periph.c @@ -1326,7 +1324,6 @@ components/soc/include/soc/sdmmc_periph.h components/soc/include/soc/sens_periph.h components/soc/include/soc/spi_periph.h components/soc/include/soc/syscon_periph.h -components/soc/include/soc/touch_sensor_periph.h components/soc/include/soc/twai_periph.h components/soc/include/soc/uart_periph.h components/soc/include/soc/uhci_periph.h