diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index d3c3e125ed..160232ca29 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -45,7 +45,7 @@ else() idf_component_register(SRCS "${srcs}" INCLUDE_DIRS ${includes} PRIV_REQUIRES esp_timer esp_mm esp_driver_gpio esp_ringbuf esp_pm - REQUIRES esp_hal_i2c esp_hal_twai + REQUIRES esp_hal_i2c esp_hal_twai esp_hal_touch_sens LDFRAGMENTS ${ldfragments} ) endif() diff --git a/components/driver/test_apps/.build-test-rules.yml b/components/driver/test_apps/.build-test-rules.yml index 79b8aef954..8d374aa1c1 100644 --- a/components/driver/test_apps/.build-test-rules.yml +++ b/components/driver/test_apps/.build-test-rules.yml @@ -25,13 +25,14 @@ components/driver/test_apps/touch_element: - if: IDF_TARGET not in ["esp32s2", "esp32s3"] reason: only supports esp32s2 and esp32s3 depends_filepatterns: - - components/soc/**/touch_sensor_periph.h - components/soc/esp32s2/**/rtc_cntl_* - components/soc/esp32s3/**/rtc_cntl_* - components/soc/esp32s2/**/rtc_io_struct.h - components/soc/esp32s3/**/rtc_io_struct.h - components/soc/esp32s2/**/sens_struct.h - components/soc/esp32s3/**/sens_struct.h + depends_components: + - esp_hal_touch_sens components/driver/test_apps/touch_sensor_v1: disable: diff --git a/components/driver/touch_sensor/esp32/touch_sensor.c b/components/driver/touch_sensor/esp32/touch_sensor.c index 5e52782b44..4d0da393dc 100644 --- a/components/driver/touch_sensor/esp32/touch_sensor.c +++ b/components/driver/touch_sensor/esp32/touch_sensor.c @@ -29,7 +29,7 @@ #endif #include "sys/queue.h" #include "hal/touch_sensor_legacy_types.h" -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" typedef struct { esp_timer_handle_t timer; @@ -52,8 +52,8 @@ static SemaphoreHandle_t rtc_touch_mux = NULL; static __attribute__((unused)) const char *TOUCH_TAG = "TOUCH_SENSOR"; -#define TOUCH_CHANNEL_CHECK(channel) ESP_RETURN_ON_FALSE(channel < SOC_MODULE_ATTR(TOUCH, CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); -#define TOUCH_CHANNEL_CHECK_ISR(channel) ESP_RETURN_ON_FALSE_ISR(channel < SOC_MODULE_ATTR(TOUCH, CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); +#define TOUCH_CHANNEL_CHECK(channel) ESP_RETURN_ON_FALSE(channel < TOUCH_LL_GET(CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); +#define TOUCH_CHANNEL_CHECK_ISR(channel) ESP_RETURN_ON_FALSE_ISR(channel < TOUCH_LL_GET(CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); #define TOUCH_NULL_POINTER_CHECK(p, name) ESP_RETURN_ON_FALSE((p), ESP_ERR_INVALID_ARG, TOUCH_TAG, "input param '"name"' is NULL") #define TOUCH_NULL_POINTER_CHECK_ISR(p, name) ESP_RETURN_ON_FALSE_ISR((p), ESP_ERR_INVALID_ARG, TOUCH_TAG, "input param '"name"' is NULL") #define TOUCH_PARAM_CHECK_STR(s) ""s" parameter error" diff --git a/components/driver/touch_sensor/esp32s2/touch_sensor.c b/components/driver/touch_sensor/esp32s2/touch_sensor.c index 1e92c1b4fe..4fe1cb3e5c 100644 --- a/components/driver/touch_sensor/esp32s2/touch_sensor.c +++ b/components/driver/touch_sensor/esp32s2/touch_sensor.c @@ -24,7 +24,7 @@ #include "esp_check.h" #include "hal/touch_sensor_legacy_types.h" -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" #ifndef NDEBUG // Enable built-in checks in queue.h in debug builds @@ -40,8 +40,8 @@ static __attribute__((unused)) const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHANNEL_CHECK(channel) do { \ - ESP_RETURN_ON_FALSE(channel < SOC_MODULE_ATTR(TOUCH, CHAN_NUM) && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \ - ESP_RETURN_ON_FALSE(channel != SOC_TOUCH_DENOISE_CHANNEL, ESP_ERR_INVALID_ARG, TOUCH_TAG, "TOUCH0 is internal denoise channel"); \ + ESP_RETURN_ON_FALSE(channel < TOUCH_LL_GET(CHAN_NUM) && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \ + ESP_RETURN_ON_FALSE(channel != TOUCH_LL_GET(DENOISE_CHAN_ID), ESP_ERR_INVALID_ARG, TOUCH_TAG, "TOUCH0 is internal denoise channel"); \ } while (0); #define TOUCH_CH_MASK_CHECK(mask) ESP_RETURN_ON_FALSE((mask <= TOUCH_PAD_BIT_MASK_ALL), ESP_ERR_INVALID_ARG, TOUCH_TAG, "touch channel bitmask error"); #define TOUCH_INTR_MASK_CHECK(mask) ESP_RETURN_ON_FALSE(mask & TOUCH_PAD_INTR_MASK_ALL, ESP_ERR_INVALID_ARG, TOUCH_TAG, "intr mask error"); @@ -422,7 +422,7 @@ esp_err_t touch_pad_filter_disable(void) esp_err_t touch_pad_denoise_enable(void) { TOUCH_ENTER_CRITICAL(); - touch_hal_clear_channel_mask(BIT(SOC_TOUCH_DENOISE_CHANNEL)); + touch_hal_clear_channel_mask(BIT(TOUCH_LL_GET(DENOISE_CHAN_ID))); touch_hal_denoise_enable(); TOUCH_EXIT_CRITICAL(); return ESP_OK; @@ -447,7 +447,7 @@ esp_err_t touch_pad_denoise_set_config(const touch_pad_denoise_t *denoise) .tie_opt = TOUCH_PAD_TIE_OPT_DEFAULT, }; TOUCH_ENTER_CRITICAL(); - touch_hal_set_meas_mode(SOC_TOUCH_DENOISE_CHANNEL, &meas); + touch_hal_set_meas_mode(TOUCH_LL_GET(DENOISE_CHAN_ID), &meas); touch_hal_denoise_set_config(denoise); TOUCH_EXIT_CRITICAL(); @@ -473,7 +473,7 @@ esp_err_t touch_pad_denoise_read_data(uint32_t *data) esp_err_t touch_pad_waterproof_set_config(const touch_pad_waterproof_t *waterproof) { TOUCH_NULL_POINTER_CHECK(waterproof, "waterproof"); - ESP_RETURN_ON_FALSE(waterproof->guard_ring_pad < SOC_MODULE_ATTR(TOUCH, CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("pad")); + ESP_RETURN_ON_FALSE(waterproof->guard_ring_pad < TOUCH_LL_GET(CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("pad")); ESP_RETURN_ON_FALSE(waterproof->shield_driver < TOUCH_PAD_SHIELD_DRV_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("shield_driver")); TOUCH_ENTER_CRITICAL(); @@ -493,7 +493,7 @@ esp_err_t touch_pad_waterproof_get_config(touch_pad_waterproof_t *waterproof) esp_err_t touch_pad_waterproof_enable(void) { - touch_pad_io_init(SOC_TOUCH_SHIELD_CHANNEL); + touch_pad_io_init(TOUCH_LL_GET(SHIELD_CHAN_ID)); TOUCH_ENTER_CRITICAL(); touch_hal_waterproof_enable(); TOUCH_EXIT_CRITICAL(); diff --git a/components/driver/touch_sensor/esp32s3/touch_sensor.c b/components/driver/touch_sensor/esp32s3/touch_sensor.c index 071a114f4f..ba05743ef2 100644 --- a/components/driver/touch_sensor/esp32s3/touch_sensor.c +++ b/components/driver/touch_sensor/esp32s3/touch_sensor.c @@ -24,7 +24,7 @@ #include "esp_check.h" #include "hal/touch_sensor_legacy_types.h" -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" #ifndef NDEBUG // Enable built-in checks in queue.h in debug builds @@ -40,8 +40,8 @@ static __attribute__((unused)) const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHANNEL_CHECK(channel) do { \ - ESP_RETURN_ON_FALSE(channel < SOC_MODULE_ATTR(TOUCH, CHAN_NUM) && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \ - ESP_RETURN_ON_FALSE(channel != SOC_TOUCH_DENOISE_CHANNEL, ESP_ERR_INVALID_ARG, TOUCH_TAG, "TOUCH0 is internal denoise channel"); \ + ESP_RETURN_ON_FALSE(channel < TOUCH_LL_GET(CHAN_NUM) && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \ + ESP_RETURN_ON_FALSE(channel != TOUCH_LL_GET(DENOISE_CHAN_ID), ESP_ERR_INVALID_ARG, TOUCH_TAG, "TOUCH0 is internal denoise channel"); \ } while (0); #define TOUCH_CH_MASK_CHECK(mask) ESP_RETURN_ON_FALSE((mask <= TOUCH_PAD_BIT_MASK_ALL), ESP_ERR_INVALID_ARG, TOUCH_TAG, "touch channel bitmask error"); #define TOUCH_INTR_MASK_CHECK(mask) ESP_RETURN_ON_FALSE(mask & TOUCH_PAD_INTR_MASK_ALL, ESP_ERR_INVALID_ARG, TOUCH_TAG, "intr mask error"); @@ -396,7 +396,7 @@ esp_err_t touch_pad_filter_disable(void) esp_err_t touch_pad_denoise_enable(void) { TOUCH_ENTER_CRITICAL(); - touch_hal_clear_channel_mask(BIT(SOC_TOUCH_DENOISE_CHANNEL)); + touch_hal_clear_channel_mask(BIT(TOUCH_LL_GET(DENOISE_CHAN_ID))); touch_hal_denoise_enable(); TOUCH_EXIT_CRITICAL(); return ESP_OK; @@ -421,7 +421,7 @@ esp_err_t touch_pad_denoise_set_config(const touch_pad_denoise_t *denoise) .tie_opt = TOUCH_PAD_TIE_OPT_DEFAULT, }; TOUCH_ENTER_CRITICAL(); - touch_hal_set_meas_mode(SOC_TOUCH_DENOISE_CHANNEL, &meas); + touch_hal_set_meas_mode(TOUCH_LL_GET(DENOISE_CHAN_ID), &meas); touch_hal_denoise_set_config(denoise); TOUCH_EXIT_CRITICAL(); @@ -446,7 +446,7 @@ esp_err_t touch_pad_denoise_read_data(uint32_t *data) esp_err_t touch_pad_waterproof_set_config(const touch_pad_waterproof_t *waterproof) { TOUCH_NULL_POINTER_CHECK(waterproof, "waterproof"); - ESP_RETURN_ON_FALSE(waterproof->guard_ring_pad < SOC_MODULE_ATTR(TOUCH, CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("pad")); + ESP_RETURN_ON_FALSE(waterproof->guard_ring_pad < TOUCH_LL_GET(CHAN_NUM), ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("pad")); ESP_RETURN_ON_FALSE(waterproof->shield_driver < TOUCH_PAD_SHIELD_DRV_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("shield_driver")); TOUCH_ENTER_CRITICAL(); @@ -466,7 +466,7 @@ esp_err_t touch_pad_waterproof_get_config(touch_pad_waterproof_t *waterproof) esp_err_t touch_pad_waterproof_enable(void) { - touch_pad_io_init(SOC_TOUCH_SHIELD_CHANNEL); + touch_pad_io_init(TOUCH_LL_GET(SHIELD_CHAN_ID)); TOUCH_ENTER_CRITICAL(); touch_hal_waterproof_enable(); TOUCH_EXIT_CRITICAL(); diff --git a/components/driver/touch_sensor/touch_sensor_common.c b/components/driver/touch_sensor/touch_sensor_common.c index 7ad4a81c3d..6b1ac26ba4 100644 --- a/components/driver/touch_sensor/touch_sensor_common.c +++ b/components/driver/touch_sensor/touch_sensor_common.c @@ -19,7 +19,7 @@ #include "esp_private/rtc_ctrl.h" #include "esp_private/gpio.h" #include "hal/touch_sensor_legacy_types.h" -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" static const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHECK(a, str, ret_val) ({ \ @@ -30,18 +30,18 @@ static const char *TOUCH_TAG = "TOUCH_SENSOR"; }) #ifdef CONFIG_IDF_TARGET_ESP32 #define TOUCH_CHANNEL_CHECK(channel) do { \ - TOUCH_CHECK(channel < SOC_MODULE_ATTR(TOUCH, CHAN_NUM) && channel >= 0, "Touch channel error", ESP_ERR_INVALID_ARG); \ + TOUCH_CHECK(channel < TOUCH_LL_GET(CHAN_NUM) && channel >= 0, "Touch channel error", ESP_ERR_INVALID_ARG); \ } while (0); #else // !CONFIG_IDF_TARGET_ESP32 #define TOUCH_CHANNEL_CHECK(channel) do { \ - TOUCH_CHECK(channel < SOC_MODULE_ATTR(TOUCH, CHAN_NUM) && channel >= 0, "Touch channel error", ESP_ERR_INVALID_ARG); \ - TOUCH_CHECK(channel != SOC_TOUCH_DENOISE_CHANNEL, "TOUCH0 is internal denoise channel", ESP_ERR_INVALID_ARG); \ + TOUCH_CHECK(channel < TOUCH_LL_GET(CHAN_NUM) && channel >= 0, "Touch channel error", ESP_ERR_INVALID_ARG); \ + TOUCH_CHECK(channel != TOUCH_LL_GET(DENOISE_CHAN_ID), "TOUCH0 is internal denoise channel", ESP_ERR_INVALID_ARG); \ } while (0); #endif // CONFIG_IDF_TARGET_ESP32 #define TOUCH_GET_IO_NUM(channel) (touch_sensor_channel_io_map[channel]) -_Static_assert(TOUCH_PAD_MAX == SOC_MODULE_ATTR(TOUCH, CHAN_NUM), "Touch sensor channel number not equal to chip capabilities"); +_Static_assert(TOUCH_PAD_MAX == TOUCH_LL_GET(CHAN_NUM), "Touch sensor channel number not equal to chip capabilities"); extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished. #define TOUCH_ENTER_CRITICAL() portENTER_CRITICAL(&rtc_spinlock) @@ -88,7 +88,7 @@ esp_err_t touch_pad_get_voltage(touch_high_volt_t *refh, touch_low_volt_t *refl, esp_err_t touch_pad_set_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t slope, touch_tie_opt_t opt) { - TOUCH_CHECK(touch_num < SOC_MODULE_ATTR(TOUCH, CHAN_NUM), "Touch channel error", ESP_ERR_INVALID_ARG); + TOUCH_CHECK(touch_num < TOUCH_LL_GET(CHAN_NUM), "Touch channel error", ESP_ERR_INVALID_ARG); TOUCH_CHECK(slope < TOUCH_PAD_SLOPE_MAX, "touch slope error", ESP_ERR_INVALID_ARG); TOUCH_CHECK(opt < TOUCH_PAD_TIE_OPT_MAX, "touch opt error", ESP_ERR_INVALID_ARG); @@ -105,7 +105,7 @@ esp_err_t touch_pad_set_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t slope, esp_err_t touch_pad_get_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t *slope, touch_tie_opt_t *opt) { - TOUCH_CHECK(touch_num < SOC_MODULE_ATTR(TOUCH, CHAN_NUM), "Touch channel error", ESP_ERR_INVALID_ARG); + TOUCH_CHECK(touch_num < TOUCH_LL_GET(CHAN_NUM), "Touch channel error", ESP_ERR_INVALID_ARG); touch_hal_meas_mode_t meas = {0}; TOUCH_ENTER_CRITICAL(); @@ -184,7 +184,7 @@ esp_err_t touch_pad_set_thresh(touch_pad_t touch_num, uint16_t threshold) esp_err_t touch_pad_set_thresh(touch_pad_t touch_num, uint32_t threshold) { TOUCH_CHANNEL_CHECK(touch_num); - TOUCH_CHECK(touch_num != SOC_TOUCH_DENOISE_CHANNEL, + TOUCH_CHECK(touch_num != TOUCH_LL_GET(DENOISE_CHAN_ID), "TOUCH0 is internal denoise channel", ESP_ERR_INVALID_ARG); TOUCH_ENTER_CRITICAL(); touch_hal_set_threshold(touch_num, threshold); @@ -204,7 +204,7 @@ esp_err_t touch_pad_get_thresh(touch_pad_t touch_num, uint16_t *threshold) esp_err_t touch_pad_get_thresh(touch_pad_t touch_num, uint32_t *threshold) { TOUCH_CHANNEL_CHECK(touch_num); - TOUCH_CHECK(touch_num != SOC_TOUCH_DENOISE_CHANNEL, + TOUCH_CHECK(touch_num != TOUCH_LL_GET(DENOISE_CHAN_ID), "TOUCH0 is internal denoise channel", ESP_ERR_INVALID_ARG); touch_hal_get_threshold(touch_num, threshold); return ESP_OK; diff --git a/components/esp_driver_touch_sens/CMakeLists.txt b/components/esp_driver_touch_sens/CMakeLists.txt index 7f77013a5e..502baa5af0 100644 --- a/components/esp_driver_touch_sens/CMakeLists.txt +++ b/components/esp_driver_touch_sens/CMakeLists.txt @@ -22,5 +22,6 @@ endif() idf_component_register(SRCS ${srcs} PRIV_REQUIRES ${priv_require} + REQUIRES esp_hal_touch_sens # public require because hal/touch_sens_type.h needs to be public INCLUDE_DIRS ${public_inc} ) diff --git a/components/esp_driver_touch_sens/common/touch_sens_common.c b/components/esp_driver_touch_sens/common/touch_sens_common.c index 39c12615c4..801a038570 100644 --- a/components/esp_driver_touch_sens/common/touch_sens_common.c +++ b/components/esp_driver_touch_sens/common/touch_sens_common.c @@ -11,7 +11,7 @@ #include "soc/soc_caps.h" #include "soc/rtc.h" #include "soc/clk_tree_defs.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "esp_private/gpio.h" #include "driver/touch_sens.h" #include "esp_private/esp_gpio_reserve.h" diff --git a/components/esp_driver_touch_sens/common/touch_sens_private.h b/components/esp_driver_touch_sens/common/touch_sens_private.h index 2750631667..85cce29ff5 100644 --- a/components/esp_driver_touch_sens/common/touch_sens_private.h +++ b/components/esp_driver_touch_sens/common/touch_sens_private.h @@ -84,7 +84,7 @@ extern portMUX_TYPE g_touch_spinlock; * */ struct touch_sensor_s { - touch_channel_handle_t ch[SOC_MODULE_ATTR(TOUCH, CHAN_NUM)]; /*!< Touch sensor channel handles, will be NULL if the channel is not registered */ + touch_channel_handle_t ch[TOUCH_LL_GET(CHAN_NUM)]; /*!< Touch sensor channel handles, will be NULL if the channel is not registered */ uint32_t chan_mask; /*!< Enabled channel mask, corresponding bit will be set if the channel is registered */ uint32_t src_freq_hz; /*!< Source clock frequency */ uint32_t interval_freq_hz; /*!< Frequency of the interval clock */ diff --git a/components/esp_driver_touch_sens/hw_ver1/touch_version_specific.c b/components/esp_driver_touch_sens/hw_ver1/touch_version_specific.c index e85f638ba1..93b1ae8e98 100644 --- a/components/esp_driver_touch_sens/hw_ver1/touch_version_specific.c +++ b/components/esp_driver_touch_sens/hw_ver1/touch_version_specific.c @@ -15,7 +15,7 @@ #include "freertos/semphr.h" #include "soc/soc_caps.h" #include "soc/clk_tree_defs.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "soc/rtc.h" #include "hal/hal_utils.h" #include "driver/touch_sens.h" diff --git a/components/esp_driver_touch_sens/hw_ver2/touch_version_specific.c b/components/esp_driver_touch_sens/hw_ver2/touch_version_specific.c index 808dc8b6c8..017434b738 100644 --- a/components/esp_driver_touch_sens/hw_ver2/touch_version_specific.c +++ b/components/esp_driver_touch_sens/hw_ver2/touch_version_specific.c @@ -15,7 +15,7 @@ #include "freertos/semphr.h" #include "soc/soc_caps.h" #include "soc/clk_tree_defs.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "soc/rtc.h" #include "hal/hal_utils.h" #include "driver/touch_sens.h" @@ -68,7 +68,7 @@ void IRAM_ATTR touch_priv_default_intr_handler(void *arg) return; } /* It actually won't be out of range in the real environment, but limit the range to pass the coverity check */ - uint32_t curr_chan_offset = (curr_chan >= SOC_MODULE_ATTR(TOUCH, CHAN_NUM) ? SOC_MODULE_ATTR(TOUCH, CHAN_NUM) - 1 : curr_chan) - TOUCH_MIN_CHAN_ID; + uint32_t curr_chan_offset = (curr_chan >= TOUCH_LL_GET(CHAN_NUM) ? TOUCH_LL_GET(CHAN_NUM) - 1 : curr_chan) - TOUCH_MIN_CHAN_ID; data.chan = g_touch->ch[curr_chan_offset]; /* If the channel is not registered, return directly */ if (!data.chan) { diff --git a/components/esp_driver_touch_sens/hw_ver3/touch_version_specific.c b/components/esp_driver_touch_sens/hw_ver3/touch_version_specific.c index ce4c5f1cc4..bb5f4c1034 100644 --- a/components/esp_driver_touch_sens/hw_ver3/touch_version_specific.c +++ b/components/esp_driver_touch_sens/hw_ver3/touch_version_specific.c @@ -15,7 +15,7 @@ #include "freertos/semphr.h" #include "soc/soc_caps.h" #include "soc/clk_tree_defs.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "soc/rtc.h" #include "soc/chip_revision.h" #include "hal/efuse_hal.h" @@ -63,7 +63,7 @@ void IRAM_ATTR touch_priv_default_intr_handler(void *arg) touch_base_event_data_t data; touch_ll_get_active_channel_mask(&data.status_mask); int ch_offset = touch_ll_get_current_meas_channel() - TOUCH_MIN_CHAN_ID; - if (ch_offset < 0 || ch_offset >= (int)SOC_MODULE_ATTR(TOUCH, CHAN_NUM)) { + if (ch_offset < 0 || ch_offset >= (int)TOUCH_LL_GET(CHAN_NUM)) { /* Not a valid channel */ return; } diff --git a/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt b/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt index 28ce111a06..88091ad89e 100644 --- a/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt +++ b/components/esp_driver_touch_sens/test_apps/touch_sens/CMakeLists.txt @@ -10,9 +10,17 @@ project(touch_sens) idf_build_get_property(elf EXECUTABLE) if(CONFIG_COMPILER_DUMP_RTL_FILES) + # Collect RTL directories in a variable for readability. Join them + # with commas so they are passed as a single --rtl-dirs argument to the script. + set(TOUCH_SENS_RTL_DIRS + ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_touch_sens + ${CMAKE_BINARY_DIR}/esp-idf/hal + ${CMAKE_BINARY_DIR}/esp-idf/esp_hal_touch_sens + ) + string(JOIN "," TOUCH_SENS_RTL_DIRS_JOINED ${TOUCH_SENS_RTL_DIRS}) add_custom_target(check_test_app_sections ALL COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py - --rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_touch_sens/,${CMAKE_BINARY_DIR}/esp-idf/hal/ + --rtl-dirs ${TOUCH_SENS_RTL_DIRS_JOINED} --elf-file ${CMAKE_BINARY_DIR}/touch_sens.elf find-refs --from-sections=.iram0.text diff --git a/components/esp_hal_touch_sens/CMakeLists.txt b/components/esp_hal_touch_sens/CMakeLists.txt new file mode 100644 index 0000000000..c9d6cfa9f7 --- /dev/null +++ b/components/esp_hal_touch_sens/CMakeLists.txt @@ -0,0 +1,28 @@ +idf_build_get_property(target IDF_TARGET) + +if(${target} STREQUAL "linux") + return() # This component is not supported by the POSIX/Linux simulator +endif() + +set(srcs) +set(includes) +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include") + list(APPEND includes "${target}/include") +endif() +# "include" should be behind "${target}/include", because `include_next` has sequence requirement +list(APPEND includes "include") + +# Touch Sensor related source files +if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) + # Source files for the legacy touch hal driver + if(CONFIG_SOC_TOUCH_SENSOR_VERSION LESS 3) + list(APPEND srcs "${target}/touch_sensor_legacy_hal.c" + "touch_sensor_legacy_hal.c" + ) + endif() + list(APPEND srcs "touch_sens_hal.c" "${target}/touch_sensor_periph.c") +endif() + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS ${includes} + REQUIRES soc hal) diff --git a/components/esp_hal_touch_sens/README.md b/components/esp_hal_touch_sens/README.md new file mode 100644 index 0000000000..86d42c1e57 --- /dev/null +++ b/components/esp_hal_touch_sens/README.md @@ -0,0 +1,52 @@ +# ESP Hardware Abstraction Layer for Touch Sensor Peripheral + +> [!NOTE] +> This component is currently in beta. Its API, behavior, and compatibility may change at any time and without notice; backward compatibility is not guaranteed. Use caution when integrating into production systems. + +## Overview + +The `esp_hal_touch_sens` component provides a **Hardware Abstraction Layer** for Touch Sensor controller supported targets. Touch sensors detect touch events by measuring changes in capacitance when a finger or object approaches the touch pad, enabling capacitive touch interfaces for user interaction. + +## Architecture + +The Touch Sensor HAL is structured in two main sub-layers: + +1. **HAL Layer (Upper)**: Defines the operational steps and data structures required to control touch sensor peripherals (e.g., initialization, channel configuration, filter setup, measurement control). + +2. **Low-Level Layer (Bottom)**: Serves as a translation layer between the HAL and the register files defined in the `soc` component, handling target-specific register configurations. + +## Supported Touch Sensor Controllers + +This HAL supports various touch sensor controller versions depending on the ESP chip: + +- **Touch Sensor Version 1**: Basic touch sensor functionality (ESP32) +- **Touch Sensor Version 2**: Enhanced features including improved filtering and denoise capabilities (ESP32-S2, ESP32-S3) +- **Touch Sensor Version 3**: Advanced features with frequency hopping, multiple sample configurations, and enhanced waterproof support (ESP32-P4 and newer chips) + +## Features + +- **Channel Management**: Multi-channel touch pad support with independent configuration +- **Measurement Control**: Configurable charge/discharge cycles, voltage thresholds, and measurement intervals +- **Filtering and Signal Processing**: + - Benchmark filter (IIR filter, jitter filter) + - Smooth data filter for noise reduction + - Debounce and noise threshold configuration + - Active threshold hysteresis +- **Denoise Function**: Internal denoise channel (T0) to filter out power supply noise and external EMI +- **Waterproof Support**: Guard pad and shield channel configuration for water-resistant applications +- **Proximity Sensing**: Up to three touch channels can be configured as proximity sensors +- **Sleep Channel**: Deep sleep wake-up support with configurable sleep channel +- **FSM Operation**: Hardware timer or software-triggered measurement modes +- **Interrupt Handling**: Multiple interrupt types (active, inactive, done, scan done, timeout, proximity done) +- **Sample Configuration**: Multiple sample configurations with frequency hopping support (Version 3) + +## Usage + +The HAL functions primarily serve ESP-IDF peripheral drivers such as `esp_driver_touch_sens`. + +Advanced developers can use these interfaces directly when implementing custom drivers, with the understanding that API stability is not guaranteed. + +## Dependencies + +- `soc`: Provides chip-specific register definitions +- `hal`: Core hardware abstraction utilities and macros diff --git a/components/hal/esp32/include/hal/touch_sensor_hal.h b/components/esp_hal_touch_sens/esp32/include/hal/touch_sensor_legacy_hal.h similarity index 98% rename from components/hal/esp32/include/hal/touch_sensor_hal.h rename to components/esp_hal_touch_sens/esp32/include/hal/touch_sensor_legacy_hal.h index dd91614088..033fbc28dc 100644 --- a/components/hal/esp32/include/hal/touch_sensor_hal.h +++ b/components/esp_hal_touch_sens/esp32/include/hal/touch_sensor_legacy_hal.h @@ -17,7 +17,7 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_legacy_types.h" -#include_next "hal/touch_sensor_hal.h" +#include_next "hal/touch_sensor_legacy_hal.h" #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32/include/hal/touch_sensor_ll.h b/components/esp_hal_touch_sens/esp32/include/hal/touch_sensor_ll.h similarity index 98% rename from components/hal/esp32/include/hal/touch_sensor_ll.h rename to components/esp_hal_touch_sens/esp32/include/hal/touch_sensor_ll.h index 31daf784af..b37b3b4514 100644 --- a/components/hal/esp32/include/hal/touch_sensor_ll.h +++ b/components/esp_hal_touch_sens/esp32/include/hal/touch_sensor_ll.h @@ -18,7 +18,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "soc/sens_struct.h" #include "soc/rtc_io_struct.h" #include "soc/rtc_cntl_struct.h" @@ -26,6 +26,9 @@ #include "soc/soc_caps_full.h" #include "hal/touch_sens_types.h" +#define TOUCH_LL_GET(_attr) TOUCH_LL_ ## _attr +#define TOUCH_LL_CHAN_NUM 10 + #ifdef __cplusplus extern "C" { #endif @@ -34,7 +37,7 @@ extern "C" { #define TOUCH_LL_BIT_SWAP(data, n, m) (((data >> n) & 0x1) == ((data >> m) & 0x1) ? (data) : ((data) ^ ((0x1 <> 1], l_val); @@ -728,9 +730,9 @@ static inline void touch_ll_get_threshold(touch_pad_t touch_num, uint16_t *thres { touch_pad_t tp_wrap = touch_ll_num_wrap(touch_num); if (threshold) { - *threshold = (tp_wrap & 0x1 ) ? - HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_thresh[tp_wrap / 2], l_thresh) : - HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_thresh[tp_wrap / 2], h_thresh); + *threshold = (tp_wrap & 0x1) ? + HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_thresh[tp_wrap / 2], l_thresh) : + HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_thresh[tp_wrap / 2], h_thresh); } } @@ -911,7 +913,7 @@ static inline uint32_t touch_ll_read_raw_data(touch_pad_t touch_num) { touch_pad_t tp_wrap = touch_ll_num_wrap(touch_num); return ((tp_wrap & 0x1) ? HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_meas[tp_wrap / 2], l_val) : - HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_meas[tp_wrap / 2], h_val)); + HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_meas[tp_wrap / 2], h_val)); } #ifdef __cplusplus diff --git a/components/hal/esp32/touch_sensor_hal.c b/components/esp_hal_touch_sens/esp32/touch_sensor_legacy_hal.c similarity index 96% rename from components/hal/esp32/touch_sensor_hal.c rename to components/esp_hal_touch_sens/esp32/touch_sensor_legacy_hal.c index b663dedaa0..b7075b8439 100644 --- a/components/hal/esp32/touch_sensor_hal.c +++ b/components/esp_hal_touch_sens/esp32/touch_sensor_legacy_hal.c @@ -6,7 +6,7 @@ // The HAL layer for Touch sensor (common part) -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" #include "hal/touch_sensor_legacy_types.h" void touch_hal_init(void) diff --git a/components/soc/esp32/touch_sensor_periph.c b/components/esp_hal_touch_sens/esp32/touch_sensor_periph.c similarity index 92% rename from components/soc/esp32/touch_sensor_periph.c rename to components/esp_hal_touch_sens/esp32/touch_sensor_periph.c index 3432d64002..26fbd01c76 100644 --- a/components/soc/esp32/touch_sensor_periph.c +++ b/components/esp_hal_touch_sens/esp32/touch_sensor_periph.c @@ -1,7 +1,7 @@ /* * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * - * SPDX-License-Identifier: Apache-2.0 OR MIT + * SPDX-License-Identifier: Apache-2.0 */ #include "soc/touch_sensor_channel.h" diff --git a/components/hal/esp32p4/include/hal/touch_sensor_ll.h b/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_ll.h similarity index 90% rename from components/hal/esp32p4/include/hal/touch_sensor_ll.h rename to components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_ll.h index 4ea8d62d4a..1c45660dd8 100644 --- a/components/hal/esp32p4/include/hal/touch_sensor_ll.h +++ b/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_ll.h @@ -16,7 +16,7 @@ #include #include "hal/misc.h" #include "hal/assert.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "soc/lp_analog_peri_struct.h" #include "soc/lp_clkrst_struct.h" #include "soc/lp_system_struct.h" @@ -28,6 +28,9 @@ #include "hal/touch_sens_types.h" #include "hal/config.h" +#define TOUCH_LL_GET(_attr) TOUCH_LL_ ## _attr +#define TOUCH_LL_CHAN_NUM 14 + #ifdef __cplusplus extern "C" { #endif @@ -47,7 +50,7 @@ extern "C" { #define TOUCH_LL_INTR_MASK_PROX_DONE BIT(5) #define TOUCH_LL_INTR_MASK_ALL (0x3F) -#define TOUCH_LL_FULL_CHANNEL_MASK ((uint16_t)((1U << (SOC_MODULE_ATTR(TOUCH, CHAN_NUM))) - 1) << SOC_TOUCH_MIN_CHAN_ID) +#define TOUCH_LL_FULL_CHANNEL_MASK ((uint16_t)((1U << (TOUCH_LL_GET(CHAN_NUM))) - 1) << SOC_TOUCH_MIN_CHAN_ID) #define TOUCH_LL_NULL_CHANNEL (15) // Null Channel id. Used for disabling some functions like sleep/proximity/waterproof #define TOUCH_LL_PAD_MEASURE_WAIT_MAX (0x7FFF) // The timer frequency is 8Mhz, the max value is 0xff @@ -100,17 +103,17 @@ static inline void touch_ll_set_charge_times(uint8_t sample_cfg_id, uint16_t cha { //The times of charge and discharge in each measure process of touch channels. switch (sample_cfg_id) { - case 0: - LP_ANA_PERI.touch_work_meas_num.touch_meas_num0 = charge_times; - break; - case 1: - LP_ANA_PERI.touch_work_meas_num.touch_meas_num1 = charge_times; - break; - case 2: - LP_ANA_PERI.touch_work_meas_num.touch_meas_num2 = charge_times; - break; - default: - abort(); + case 0: + LP_ANA_PERI.touch_work_meas_num.touch_meas_num0 = charge_times; + break; + case 1: + LP_ANA_PERI.touch_work_meas_num.touch_meas_num1 = charge_times; + break; + case 2: + LP_ANA_PERI.touch_work_meas_num.touch_meas_num2 = charge_times; + break; + default: + abort(); } } @@ -122,17 +125,17 @@ static inline void touch_ll_set_charge_times(uint8_t sample_cfg_id, uint16_t cha static inline void touch_ll_get_charge_times(uint8_t sample_cfg_id, uint16_t *charge_times) { switch (sample_cfg_id) { - case 0: - *charge_times = LP_ANA_PERI.touch_work_meas_num.touch_meas_num0; - break; - case 1: - *charge_times = LP_ANA_PERI.touch_work_meas_num.touch_meas_num1; - break; - case 2: - *charge_times = LP_ANA_PERI.touch_work_meas_num.touch_meas_num2; - break; - default: - abort(); + case 0: + *charge_times = LP_ANA_PERI.touch_work_meas_num.touch_meas_num0; + break; + case 1: + *charge_times = LP_ANA_PERI.touch_work_meas_num.touch_meas_num1; + break; + case 2: + *charge_times = LP_ANA_PERI.touch_work_meas_num.touch_meas_num2; + break; + default: + abort(); } } @@ -203,8 +206,8 @@ static inline void touch_ll_force_done_curr_measurement(void) PMU.touch_pwr_cntl.force_done = 1; // Force done signal should last at least one slow clock tick, wait until tick interrupt triggers LP_SYS.int_clr.slow_clk_tick_int_clr = 1; - while(LP_SYS.int_clr.slow_clk_tick_int_clr); - while(!LP_SYS.int_raw.slow_clk_tick_int_raw); + while (LP_SYS.int_clr.slow_clk_tick_int_clr); + while (!LP_SYS.int_raw.slow_clk_tick_int_raw); // Clear `force done` signal PMU.touch_pwr_cntl.force_done = 0; // Disable event tick @@ -451,18 +454,18 @@ static inline void touch_ll_enable_out_gate(bool enable) static inline void touch_ll_set_clock_div(uint8_t sample_cfg_id, uint32_t div_num) { switch (sample_cfg_id) { - case 0: - LP_ANA_PERI.touch_work.div_num0 = div_num - 1; - break; - case 1: - LP_ANA_PERI.touch_work.div_num1 = div_num - 1; - break; - case 2: - LP_ANA_PERI.touch_work.div_num2 = div_num - 1; - break; - default: - // invalid sample_cfg_id - abort(); + case 0: + LP_ANA_PERI.touch_work.div_num0 = div_num - 1; + break; + case 1: + LP_ANA_PERI.touch_work.div_num1 = div_num - 1; + break; + case 2: + LP_ANA_PERI.touch_work.div_num2 = div_num - 1; + break; + default: + // invalid sample_cfg_id + abort(); } } @@ -829,18 +832,18 @@ static inline void touch_ll_waterproof_set_shield_driver(touch_chan_shield_cap_t static inline void touch_ll_set_proximity_sensing_channel(uint8_t prox_chan, uint32_t touch_num) { switch (prox_chan) { - case 0: - LP_ANA_PERI.touch_approach.touch_approach_pad0 = touch_num; - break; - case 1: - LP_ANA_PERI.touch_approach.touch_approach_pad1 = touch_num; - break; - case 2: - LP_ANA_PERI.touch_approach.touch_approach_pad2 = touch_num; - break; - default: - // invalid proximity channel - abort(); + case 0: + LP_ANA_PERI.touch_approach.touch_approach_pad0 = touch_num; + break; + case 1: + LP_ANA_PERI.touch_approach.touch_approach_pad1 = touch_num; + break; + case 2: + LP_ANA_PERI.touch_approach.touch_approach_pad2 = touch_num; + break; + default: + // invalid proximity channel + abort(); } } @@ -863,18 +866,18 @@ static inline void touch_ll_proximity_set_total_scan_times(uint32_t scan_times) static inline void touch_ll_proximity_set_charge_times(uint8_t sample_cfg_id, uint32_t charge_times) { switch (sample_cfg_id) { - case 0: - LP_ANA_PERI.touch_approach_work_meas_num.touch_approach_meas_num0 = charge_times; - break; - case 1: - LP_ANA_PERI.touch_approach_work_meas_num.touch_approach_meas_num1 = charge_times; - break; - case 2: - LP_ANA_PERI.touch_approach_work_meas_num.touch_approach_meas_num2 = charge_times; - break; - default: - // invalid sample_cfg_id - abort(); + case 0: + LP_ANA_PERI.touch_approach_work_meas_num.touch_approach_meas_num0 = charge_times; + break; + case 1: + LP_ANA_PERI.touch_approach_work_meas_num.touch_approach_meas_num1 = charge_times; + break; + case 2: + LP_ANA_PERI.touch_approach_work_meas_num.touch_approach_meas_num2 = charge_times; + break; + default: + // invalid sample_cfg_id + abort(); } } @@ -887,18 +890,18 @@ static inline void touch_ll_proximity_set_charge_times(uint8_t sample_cfg_id, ui static inline void touch_ll_proximity_read_measure_cnt(uint8_t prox_chan, uint32_t *cnt) { switch (prox_chan) { - case 0: - *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, approach_pad0_cnt); - break; - case 1: - *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, approach_pad1_cnt); - break; - case 2: - *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, approach_pad2_cnt); - break; - default: // sleep channel - *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, slp_approach_cnt); - break; + case 0: + *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, approach_pad0_cnt); + break; + case 1: + *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, approach_pad1_cnt); + break; + case 2: + *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, approach_pad2_cnt); + break; + default: // sleep channel + *cnt = HAL_FORCE_READ_U32_REG_FIELD(LP_TOUCH.aprch_ch_data, slp_approach_cnt); + break; } } @@ -910,8 +913,8 @@ static inline void touch_ll_proximity_read_measure_cnt(uint8_t prox_chan, uint32 static inline bool touch_ll_is_proximity_sensing_channel(uint32_t touch_num) { if ((LP_ANA_PERI.touch_approach.touch_approach_pad0 != touch_num) - && (LP_ANA_PERI.touch_approach.touch_approach_pad1 != touch_num) - && (LP_ANA_PERI.touch_approach.touch_approach_pad2 != touch_num)) { + && (LP_ANA_PERI.touch_approach.touch_approach_pad1 != touch_num) + && (LP_ANA_PERI.touch_approach.touch_approach_pad2 != touch_num)) { return false; } return true; @@ -951,18 +954,18 @@ static inline void touch_ll_sleep_get_channel_num(uint32_t *touch_num) static inline void touch_ll_sleep_set_threshold(uint8_t sample_cfg_id, uint32_t touch_thresh) { switch (sample_cfg_id) { - case 0: - HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_slp0, touch_slp_th0, touch_thresh); - break; - case 1: - HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_slp1, touch_slp_th1, touch_thresh); - break; - case 2: - HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_slp1, touch_slp_th2, touch_thresh); - break; - default: - // invalid sample_cfg_id - abort(); + case 0: + HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_slp0, touch_slp_th0, touch_thresh); + break; + case 1: + HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_slp1, touch_slp_th1, touch_thresh); + break; + case 2: + HAL_FORCE_MODIFY_U32_REG_FIELD(LP_ANA_PERI.touch_slp1, touch_slp_th2, touch_thresh); + break; + default: + // invalid sample_cfg_id + abort(); } } diff --git a/components/soc/esp32p4/touch_sensor_periph.c b/components/esp_hal_touch_sens/esp32p4/touch_sensor_periph.c similarity index 94% rename from components/soc/esp32p4/touch_sensor_periph.c rename to components/esp_hal_touch_sens/esp32p4/touch_sensor_periph.c index 755261ecf7..0bf598389a 100644 --- a/components/soc/esp32p4/touch_sensor_periph.c +++ b/components/esp_hal_touch_sens/esp32p4/touch_sensor_periph.c @@ -1,7 +1,7 @@ /* * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * - * SPDX-License-Identifier: Apache-2.0 OR MIT + * SPDX-License-Identifier: Apache-2.0 */ #include "soc/touch_sensor_channel.h" diff --git a/components/hal/esp32s2/include/hal/touch_sensor_hal.h b/components/esp_hal_touch_sens/esp32s2/include/hal/touch_sensor_legacy_hal.h similarity index 99% rename from components/hal/esp32s2/include/hal/touch_sensor_hal.h rename to components/esp_hal_touch_sens/esp32s2/include/hal/touch_sensor_legacy_hal.h index d74b83b937..73ccbf184a 100644 --- a/components/hal/esp32s2/include/hal/touch_sensor_hal.h +++ b/components/esp_hal_touch_sens/esp32s2/include/hal/touch_sensor_legacy_hal.h @@ -17,7 +17,7 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_legacy_types.h" -#include_next "hal/touch_sensor_hal.h" +#include_next "hal/touch_sensor_legacy_hal.h" #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32s2/include/hal/touch_sensor_ll.h b/components/esp_hal_touch_sens/esp32s2/include/hal/touch_sensor_ll.h similarity index 98% rename from components/hal/esp32s2/include/hal/touch_sensor_ll.h rename to components/esp_hal_touch_sens/esp32s2/include/hal/touch_sensor_ll.h index 09e4bf0b39..85e81612e3 100644 --- a/components/hal/esp32s2/include/hal/touch_sensor_ll.h +++ b/components/esp_hal_touch_sens/esp32s2/include/hal/touch_sensor_ll.h @@ -19,7 +19,7 @@ #include "esp_bit_defs.h" #include "hal/misc.h" #include "hal/assert.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "soc/soc_caps.h" #include "soc/soc_caps_full.h" #include "soc/sens_struct.h" @@ -27,6 +27,13 @@ #include "soc/rtc_io_struct.h" #include "hal/touch_sens_types.h" +#define TOUCH_LL_GET(_attr) TOUCH_LL_ ## _attr +#define TOUCH_LL_CHAN_NUM 15 +#define TOUCH_LL_SHIELD_CHAN_ID 14 /*!< The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) */ +#define TOUCH_LL_DENOISE_CHAN_ID 0 /*!< T0 is an internal channel that does not have a corresponding external GPIO. + T0 will work simultaneously with the measured channel Tn. Finally, the actual + measured value of Tn is the value after subtracting lower bits of T0. */ + #ifdef __cplusplus extern "C" { #endif @@ -54,7 +61,7 @@ extern "C" { TOUCH_LL_INTR_MASK_INACTIVE | \ TOUCH_LL_INTR_MASK_TIMEOUT) -#define TOUCH_LL_FULL_CHANNEL_MASK ((uint16_t)((1U << SOC_MODULE_ATTR(TOUCH, CHAN_NUM)) - 1)) +#define TOUCH_LL_FULL_CHANNEL_MASK ((uint16_t)((1U << TOUCH_LL_GET(CHAN_NUM)) - 1)) #define TOUCH_LL_NULL_CHANNEL (0) // Null Channel id. Used for disabling some functions like sleep/proximity/waterproof #define TOUCH_LL_PAD_MEASURE_WAIT_MAX (0xFF) // The timer frequency is 8Mhz, the max value is 0xff @@ -234,7 +241,7 @@ static inline void touch_ll_set_power_on_wait_cycle(uint32_t wait_cycles) * @param charge_times The times of charge and discharge in each measure process of touch channels. * The timer frequency is RTC_FAST (about 16M). Range: 0 ~ 0xffff. */ -static inline void touch_ll_set_charge_times( uint16_t charge_times) +static inline void touch_ll_set_charge_times(uint16_t charge_times) { HAL_FORCE_MODIFY_U32_REG_FIELD(RTCCNTL.touch_ctrl1, touch_meas_num, charge_times); } @@ -441,7 +448,6 @@ static inline bool touch_ll_is_fsm_repeated_timer_enabled(void) return (bool)RTCCNTL.touch_ctrl2.touch_slp_timer_en; } - /** * Enable the touch sensor FSM start signal from software */ @@ -688,18 +694,18 @@ static inline void touch_ll_waterproof_set_shield_driver(touch_chan_shield_cap_t static inline void touch_ll_set_proximity_sensing_channel(uint8_t prox_chan, uint32_t touch_num) { switch (prox_chan) { - case 0: - SENS.sar_touch_conf.touch_approach_pad0 = touch_num; - break; - case 1: - SENS.sar_touch_conf.touch_approach_pad1 = touch_num; - break; - case 2: - SENS.sar_touch_conf.touch_approach_pad2 = touch_num; - break; - default: - // invalid proximity channel - abort(); + case 0: + SENS.sar_touch_conf.touch_approach_pad0 = touch_num; + break; + case 1: + SENS.sar_touch_conf.touch_approach_pad1 = touch_num; + break; + case 2: + SENS.sar_touch_conf.touch_approach_pad2 = touch_num; + break; + default: + // invalid proximity channel + abort(); } } diff --git a/components/hal/esp32s2/touch_sensor_hal.c b/components/esp_hal_touch_sens/esp32s2/touch_sensor_legacy_hal.c similarity index 95% rename from components/hal/esp32s2/touch_sensor_hal.c rename to components/esp_hal_touch_sens/esp32s2/touch_sensor_legacy_hal.c index fe0ad605a6..4c11f843c1 100644 --- a/components/hal/esp32s2/touch_sensor_hal.c +++ b/components/esp_hal_touch_sens/esp32s2/touch_sensor_legacy_hal.c @@ -7,8 +7,7 @@ // The HAL layer for Touch Sensor (common part) #include "soc/soc_pins.h" -#include "soc/touch_sensor_pins.h" -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" #include "hal/touch_sensor_legacy_types.h" static int s_sleep_cycle = -1; @@ -50,7 +49,7 @@ void touch_hal_deinit(void) touch_ll_timeout_disable(); touch_ll_waterproof_enable(false); touch_ll_denoise_enable(false); - touch_pad_t prox_pad[SOC_TOUCH_PROXIMITY_CHANNEL_NUM] = {[0 ... (SOC_TOUCH_PROXIMITY_CHANNEL_NUM - 1)] = 0}; + touch_pad_t prox_pad[SOC_TOUCH_PROXIMITY_CHANNEL_NUM] = {[0 ...(SOC_TOUCH_PROXIMITY_CHANNEL_NUM - 1)] = 0}; touch_ll_proximity_set_channel_num((const touch_pad_t *)prox_pad); touch_ll_sleep_set_channel_num(0); touch_ll_sleep_enable_proximity_sensing(false); @@ -89,7 +88,7 @@ void touch_hal_denoise_get_config(touch_pad_denoise_t *denoise) void touch_hal_denoise_enable(void) { - touch_ll_clear_channel_mask(1U << SOC_TOUCH_DENOISE_CHANNEL); + touch_ll_clear_channel_mask(1U << TOUCH_LL_GET(DENOISE_CHAN_ID)); touch_ll_denoise_enable(true); } @@ -107,7 +106,7 @@ void touch_hal_waterproof_get_config(touch_pad_waterproof_t *waterproof) void touch_hal_waterproof_enable(void) { - touch_ll_clear_channel_mask(1U << SOC_TOUCH_SHIELD_CHANNEL); + touch_ll_clear_channel_mask(1U << TOUCH_LL_GET(SHIELD_CHAN_ID)); touch_ll_waterproof_enable(true); } diff --git a/components/soc/esp32s2/touch_sensor_periph.c b/components/esp_hal_touch_sens/esp32s2/touch_sensor_periph.c similarity index 94% rename from components/soc/esp32s2/touch_sensor_periph.c rename to components/esp_hal_touch_sens/esp32s2/touch_sensor_periph.c index 21d217b1e2..dc02e62ba6 100644 --- a/components/soc/esp32s2/touch_sensor_periph.c +++ b/components/esp_hal_touch_sens/esp32s2/touch_sensor_periph.c @@ -1,7 +1,7 @@ /* * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * - * SPDX-License-Identifier: Apache-2.0 OR MIT + * SPDX-License-Identifier: Apache-2.0 */ #include "soc/touch_sensor_channel.h" diff --git a/components/hal/esp32s3/include/hal/touch_sensor_hal.h b/components/esp_hal_touch_sens/esp32s3/include/hal/touch_sensor_legacy_hal.h similarity index 99% rename from components/hal/esp32s3/include/hal/touch_sensor_hal.h rename to components/esp_hal_touch_sens/esp32s3/include/hal/touch_sensor_legacy_hal.h index 94219cfb57..1260447e4d 100644 --- a/components/hal/esp32s3/include/hal/touch_sensor_hal.h +++ b/components/esp_hal_touch_sens/esp32s3/include/hal/touch_sensor_legacy_hal.h @@ -17,7 +17,7 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_legacy_types.h" -#include_next "hal/touch_sensor_hal.h" +#include_next "hal/touch_sensor_legacy_hal.h" #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32s3/include/hal/touch_sensor_ll.h b/components/esp_hal_touch_sens/esp32s3/include/hal/touch_sensor_ll.h similarity index 98% rename from components/hal/esp32s3/include/hal/touch_sensor_ll.h rename to components/esp_hal_touch_sens/esp32s3/include/hal/touch_sensor_ll.h index 5926d39b50..519e1106d9 100644 --- a/components/hal/esp32s3/include/hal/touch_sensor_ll.h +++ b/components/esp_hal_touch_sens/esp32s3/include/hal/touch_sensor_ll.h @@ -19,7 +19,7 @@ #include "esp_bit_defs.h" #include "hal/misc.h" #include "hal/assert.h" -#include "soc/touch_sensor_periph.h" +#include "hal/touch_sensor_periph.h" #include "soc/rtc_cntl_struct.h" #include "soc/rtc_io_struct.h" #include "soc/sens_struct.h" @@ -27,6 +27,13 @@ #include "soc/soc_caps_full.h" #include "hal/touch_sens_types.h" +#define TOUCH_LL_GET(_attr) TOUCH_LL_ ## _attr +#define TOUCH_LL_CHAN_NUM 15 +#define TOUCH_LL_SHIELD_CHAN_ID 14 /*!< The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) */ +#define TOUCH_LL_DENOISE_CHAN_ID 0 /*!< T0 is an internal channel that does not have a corresponding external GPIO. + T0 will work simultaneously with the measured channel Tn. Finally, the actual + measured value of Tn is the value after subtracting lower bits of T0. */ + #ifdef __cplusplus extern "C" { #endif @@ -50,7 +57,7 @@ extern "C" { TOUCH_LL_INTR_MASK_TIMEOUT | \ TOUCH_LL_INTR_MASK_PROX_DONE) -#define TOUCH_LL_FULL_CHANNEL_MASK ((uint16_t)((1U << SOC_MODULE_ATTR(TOUCH, CHAN_NUM)) - 1)) +#define TOUCH_LL_FULL_CHANNEL_MASK ((uint16_t)((1U << TOUCH_LL_GET(CHAN_NUM)) - 1)) #define TOUCH_LL_NULL_CHANNEL (0) // Null Channel id. Used for disabling some functions like sleep/proximity/waterproof #define TOUCH_LL_PAD_MEASURE_WAIT_MAX (0xFF) // The timer frequency is 8Mhz, the max value is 0xff @@ -230,7 +237,7 @@ static inline void touch_ll_set_power_on_wait_cycle(uint32_t wait_cycles) * @param charge_times The times of charge and discharge in each measure process of touch channels. * The timer frequency is RTC_FAST (about 16M). Range: 0 ~ 0xffff. */ -static inline void touch_ll_set_charge_times( uint16_t charge_times) +static inline void touch_ll_set_charge_times(uint16_t charge_times) { HAL_FORCE_MODIFY_U32_REG_FIELD(RTCCNTL.touch_ctrl1, touch_meas_num, charge_times); } @@ -368,7 +375,6 @@ static inline void touch_ll_clear_active_channel_status(void) SENS.sar_touch_conf.touch_status_clr = 1; } - /** * Select touch sensor dbias to save power in sleep mode. * @@ -521,7 +527,6 @@ static inline void touch_ll_filter_enable(bool enable) RTCCNTL.touch_filter_ctrl.touch_filter_en = enable; } - /** * Set filter mode. The input of the filter is the raw value of touch reading, * and the output of the filter is involved in the judgment of the touch state. @@ -699,18 +704,18 @@ static inline void touch_ll_waterproof_set_shield_driver(touch_chan_shield_cap_t static inline void touch_ll_set_proximity_sensing_channel(uint8_t prox_chan, uint32_t touch_num) { switch (prox_chan) { - case 0: - SENS.sar_touch_conf.touch_approach_pad0 = touch_num; - break; - case 1: - SENS.sar_touch_conf.touch_approach_pad1 = touch_num; - break; - case 2: - SENS.sar_touch_conf.touch_approach_pad2 = touch_num; - break; - default: - // invalid proximity channel - abort(); + case 0: + SENS.sar_touch_conf.touch_approach_pad0 = touch_num; + break; + case 1: + SENS.sar_touch_conf.touch_approach_pad1 = touch_num; + break; + case 2: + SENS.sar_touch_conf.touch_approach_pad2 = touch_num; + break; + default: + // invalid proximity channel + abort(); } } @@ -1757,7 +1762,6 @@ static inline void touch_ll_sleep_read_chan_data(uint8_t type, uint32_t *data) } } - /** * Select touch sensor dbias to save power in sleep mode. * diff --git a/components/hal/esp32s3/touch_sensor_hal.c b/components/esp_hal_touch_sens/esp32s3/touch_sensor_legacy_hal.c similarity index 96% rename from components/hal/esp32s3/touch_sensor_hal.c rename to components/esp_hal_touch_sens/esp32s3/touch_sensor_legacy_hal.c index f4a662af59..ed667f0b81 100644 --- a/components/hal/esp32s3/touch_sensor_hal.c +++ b/components/esp_hal_touch_sens/esp32s3/touch_sensor_legacy_hal.c @@ -7,7 +7,7 @@ // The HAL layer for Touch Sensor (common part) #include "soc/soc_pins.h" -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_legacy_types.h" #include "soc/soc_caps.h" @@ -51,7 +51,7 @@ void touch_hal_deinit(void) touch_ll_timeout_disable(); touch_ll_waterproof_enable(false); touch_ll_denoise_enable(false); - touch_pad_t prox_pad[SOC_TOUCH_PROXIMITY_CHANNEL_NUM] = {[0 ... (SOC_TOUCH_PROXIMITY_CHANNEL_NUM - 1)] = 0}; + touch_pad_t prox_pad[SOC_TOUCH_PROXIMITY_CHANNEL_NUM] = {[0 ...(SOC_TOUCH_PROXIMITY_CHANNEL_NUM - 1)] = 0}; touch_ll_proximity_set_channel_num((const touch_pad_t *)prox_pad); touch_ll_sleep_set_channel_num(0); touch_ll_sleep_enable_proximity_sensing(false); @@ -90,7 +90,7 @@ void touch_hal_denoise_get_config(touch_pad_denoise_t *denoise) void touch_hal_denoise_enable(void) { - touch_ll_clear_channel_mask(1U << SOC_TOUCH_DENOISE_CHANNEL); + touch_ll_clear_channel_mask(1U << TOUCH_LL_GET(DENOISE_CHAN_ID)); touch_ll_denoise_enable(true); } @@ -108,7 +108,7 @@ void touch_hal_waterproof_get_config(touch_pad_waterproof_t *waterproof) void touch_hal_waterproof_enable(void) { - touch_ll_clear_channel_mask(1U << SOC_TOUCH_SHIELD_CHANNEL); + touch_ll_clear_channel_mask(1U << TOUCH_LL_GET(SHIELD_CHAN_ID)); touch_ll_waterproof_enable(true); } diff --git a/components/soc/esp32s3/touch_sensor_periph.c b/components/esp_hal_touch_sens/esp32s3/touch_sensor_periph.c similarity index 94% rename from components/soc/esp32s3/touch_sensor_periph.c rename to components/esp_hal_touch_sens/esp32s3/touch_sensor_periph.c index 21d217b1e2..dc02e62ba6 100644 --- a/components/soc/esp32s3/touch_sensor_periph.c +++ b/components/esp_hal_touch_sens/esp32s3/touch_sensor_periph.c @@ -1,7 +1,7 @@ /* * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * - * SPDX-License-Identifier: Apache-2.0 OR MIT + * SPDX-License-Identifier: Apache-2.0 */ #include "soc/touch_sensor_channel.h" diff --git a/components/hal/include/hal/touch_sens_hal.h b/components/esp_hal_touch_sens/include/hal/touch_sens_hal.h similarity index 99% rename from components/hal/include/hal/touch_sens_hal.h rename to components/esp_hal_touch_sens/include/hal/touch_sens_hal.h index 84fbdad205..6f0bc56629 100644 --- a/components/hal/include/hal/touch_sens_hal.h +++ b/components/esp_hal_touch_sens/include/hal/touch_sens_hal.h @@ -10,7 +10,6 @@ * See readme.md in hal/include/hal/readme.md ******************************************************************************/ - #pragma once #include "soc/soc_caps.h" @@ -105,7 +104,7 @@ typedef struct { * of the sample configurations below. */ touch_out_mode_t output_mode; /*!< Touch channel counting mode of the binarized touch output */ - #endif // SOC_TOUCH_SENSOR_VERSION == 3 +#endif // SOC_TOUCH_SENSOR_VERSION == 3 uint32_t sample_cfg_num; /*!< The sample configuration number that used for sampling */ uint32_t trigger_rise_cnt; /*!< The counter of triggered frequency points to judge whether a channel active. * For example, there are 3 sample configurations activated, and the trigger_rise_cnt is 2, diff --git a/components/hal/include/hal/touch_sens_types.h b/components/esp_hal_touch_sens/include/hal/touch_sens_types.h similarity index 100% rename from components/hal/include/hal/touch_sens_types.h rename to components/esp_hal_touch_sens/include/hal/touch_sens_types.h diff --git a/components/hal/include/hal/touch_sensor_hal.h b/components/esp_hal_touch_sens/include/hal/touch_sensor_legacy_hal.h similarity index 100% rename from components/hal/include/hal/touch_sensor_hal.h rename to components/esp_hal_touch_sens/include/hal/touch_sensor_legacy_hal.h diff --git a/components/hal/include/hal/touch_sensor_legacy_types.h b/components/esp_hal_touch_sens/include/hal/touch_sensor_legacy_types.h similarity index 100% rename from components/hal/include/hal/touch_sensor_legacy_types.h rename to components/esp_hal_touch_sens/include/hal/touch_sensor_legacy_types.h diff --git a/components/soc/include/soc/touch_sensor_periph.h b/components/esp_hal_touch_sens/include/hal/touch_sensor_periph.h similarity index 84% rename from components/soc/include/soc/touch_sensor_periph.h rename to components/esp_hal_touch_sens/include/hal/touch_sensor_periph.h index da4376382e..1e6c7d6db1 100644 --- a/components/soc/include/soc/touch_sensor_periph.h +++ b/components/esp_hal_touch_sens/include/hal/touch_sensor_periph.h @@ -1,7 +1,7 @@ /* * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * - * SPDX-License-Identifier: Apache-2.0 OR MIT + * SPDX-License-Identifier: Apache-2.0 */ #pragma once diff --git a/components/hal/touch_sens_hal.c b/components/esp_hal_touch_sens/touch_sens_hal.c similarity index 95% rename from components/hal/touch_sens_hal.c rename to components/esp_hal_touch_sens/touch_sens_hal.c index 31353bdc53..54b7572919 100644 --- a/components/hal/touch_sens_hal.c +++ b/components/esp_hal_touch_sens/touch_sens_hal.c @@ -10,7 +10,6 @@ #include "hal/touch_sens_hal.h" #include "hal/touch_sens_types.h" - typedef struct { bool deep_slp_allow_pd; int deep_slp_chan; @@ -81,14 +80,14 @@ static void s_touch_hal_apply_sleep_config(void) /* Apply the particular configuration for deep sleep */ if (s_touch_slp_obj.apply_slp_cfg) { /* Save the current channel threshold first, because they will be reset by hardware after the recofniguration */ - uint32_t chan_thresh[SOC_MODULE_ATTR(TOUCH, CHAN_NUM)] = {}; - for (int i = 0; i < SOC_MODULE_ATTR(TOUCH, CHAN_NUM); i++) { + uint32_t chan_thresh[TOUCH_LL_GET(CHAN_NUM)] = {}; + for (int i = 0; i < TOUCH_LL_GET(CHAN_NUM); i++) { chan_thresh[i] = touch_ll_get_chan_active_threshold(i); } /* Reconfigure the touch sensor to use the sleep configuration */ touch_hal_config_controller(&s_touch_slp_obj.slp_cfg); /* Restore the channel threshold */ - for (int i = 0; i < SOC_MODULE_ATTR(TOUCH, CHAN_NUM); i++) { + for (int i = 0; i < TOUCH_LL_GET(CHAN_NUM); i++) { touch_ll_set_chan_active_threshold(i, chan_thresh[i]); } } diff --git a/components/hal/touch_sensor_hal.c b/components/esp_hal_touch_sens/touch_sensor_legacy_hal.c similarity index 96% rename from components/hal/touch_sensor_hal.c rename to components/esp_hal_touch_sens/touch_sensor_legacy_hal.c index 3121f03e2d..91e3dbb880 100644 --- a/components/hal/touch_sensor_hal.c +++ b/components/esp_hal_touch_sens/touch_sensor_legacy_hal.c @@ -6,7 +6,7 @@ // The HAL layer for Touch Sensor (common part) -#include "hal/touch_sensor_hal.h" +#include "hal/touch_sensor_legacy_hal.h" #include "hal/touch_sensor_legacy_types.h" #include "soc/soc_caps.h" diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index 7944e3c0d7..fd44895642 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -73,6 +73,7 @@ if(NOT non_os_build) # [refactor-todo] list(APPEND priv_requires esp_driver_gpio # for GPIO and RTC (by sleep_gpio and sleep_modes) esp_timer + esp_hal_touch_sens # for touch sensor wakeup (introduced in sleep_modes.c) esp_pm) list(APPEND priv_requires esp_mm diff --git a/components/esp_hw_support/include/esp_sleep.h b/components/esp_hw_support/include/esp_sleep.h index 72c872c703..19e9462cf4 100644 --- a/components/esp_hw_support/include/esp_sleep.h +++ b/components/esp_hw_support/include/esp_sleep.h @@ -9,7 +9,6 @@ #include #include "esp_err.h" -#include "hal/touch_sensor_legacy_types.h" #include "hal/gpio_types.h" #include "soc/soc_caps.h" diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index f12b0ea905..0f3ae8796e 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -197,16 +197,6 @@ elseif(NOT BOOTLOADER_BUILD) list(APPEND srcs "ds_hal.c") endif() - if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) - # Source files for the legacy touch hal driver - if(CONFIG_SOC_TOUCH_SENSOR_VERSION LESS 3) - list(APPEND srcs "${target}/touch_sensor_hal.c") - list(APPEND srcs "touch_sensor_hal.c") - endif() - # Source files for the new touch hal driver - list(APPEND srcs "touch_sens_hal.c") - endif() - if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED) list(APPEND srcs "temperature_sensor_hal.c") endif() diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 6a8087fad0..de4d8f97a1 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -105,10 +105,6 @@ if(CONFIG_SOC_SDMMC_HOST_SUPPORTED) list(APPEND srcs "${target_folder}/sdmmc_periph.c") endif() -if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) - list(APPEND srcs "${target_folder}/touch_sensor_periph.c") -endif() - if(CONFIG_SOC_IEEE802154_SUPPORTED) list(APPEND srcs "${target_folder}/ieee802154_periph.c") endif() diff --git a/components/soc/esp32/include/soc/soc_caps_full.h b/components/soc/esp32/include/soc/soc_caps_full.h index 386e4ae0b4..f031101adc 100644 --- a/components/soc/esp32/include/soc/soc_caps_full.h +++ b/components/soc/esp32/include/soc/soc_caps_full.h @@ -8,6 +8,3 @@ #include "soc/soc_caps.h" #include "soc/soc_caps_eval.h" - -/*------------------------------- Touch Sensor ------------------------------------*/ -#define _SOC_CAPS_TOUCH_CHAN_NUM 10 // Number of touch sensor channels diff --git a/components/soc/esp32p4/include/soc/soc_caps_full.h b/components/soc/esp32p4/include/soc/soc_caps_full.h index 0fd0d6108d..f031101adc 100644 --- a/components/soc/esp32p4/include/soc/soc_caps_full.h +++ b/components/soc/esp32p4/include/soc/soc_caps_full.h @@ -8,6 +8,3 @@ #include "soc/soc_caps.h" #include "soc/soc_caps_eval.h" - -/*------------------------------- Touch Sensor ------------------------------------*/ -#define _SOC_CAPS_TOUCH_CHAN_NUM 14 // Number of touch sensor channels diff --git a/components/soc/esp32s2/include/soc/soc_caps_full.h b/components/soc/esp32s2/include/soc/soc_caps_full.h index 018f254fb9..f031101adc 100644 --- a/components/soc/esp32s2/include/soc/soc_caps_full.h +++ b/components/soc/esp32s2/include/soc/soc_caps_full.h @@ -8,6 +8,3 @@ #include "soc/soc_caps.h" #include "soc/soc_caps_eval.h" - -/*------------------------------- Touch Sensor ------------------------------------*/ -#define _SOC_CAPS_TOUCH_CHAN_NUM 15 // Number of touch sensor channels diff --git a/components/soc/esp32s2/include/soc/soc_pins.h b/components/soc/esp32s2/include/soc/soc_pins.h index 9ca62586a7..aa5d337198 100644 --- a/components/soc/esp32s2/include/soc/soc_pins.h +++ b/components/soc/esp32s2/include/soc/soc_pins.h @@ -9,4 +9,3 @@ #include "soc/usb_pins.h" #include "soc/gpio_pins.h" #include "soc/spi_pins.h" -#include "soc/touch_sensor_pins.h" diff --git a/components/soc/esp32s2/include/soc/touch_sensor_pins.h b/components/soc/esp32s2/include/soc/touch_sensor_pins.h deleted file mode 100644 index 6ec17be72a..0000000000 --- a/components/soc/esp32s2/include/soc/touch_sensor_pins.h +++ /dev/null @@ -1,28 +0,0 @@ -// 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. - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#define SOC_TOUCH_SHIELD_CHANNEL (14) /*!< The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) */ -#define SOC_TOUCH_DENOISE_CHANNEL (0) /*!< T0 is an internal channel that does not have a corresponding external GPIO. - T0 will work simultaneously with the measured channel Tn. Finally, the actual - measured value of Tn is the value after subtracting lower bits of T0. */ - -#ifdef __cplusplus -} -#endif diff --git a/components/soc/esp32s3/include/soc/soc_caps_full.h b/components/soc/esp32s3/include/soc/soc_caps_full.h index 018f254fb9..f031101adc 100644 --- a/components/soc/esp32s3/include/soc/soc_caps_full.h +++ b/components/soc/esp32s3/include/soc/soc_caps_full.h @@ -8,6 +8,3 @@ #include "soc/soc_caps.h" #include "soc/soc_caps_eval.h" - -/*------------------------------- Touch Sensor ------------------------------------*/ -#define _SOC_CAPS_TOUCH_CHAN_NUM 15 // Number of touch sensor channels diff --git a/components/soc/esp32s3/include/soc/soc_pins.h b/components/soc/esp32s3/include/soc/soc_pins.h index 7411d4b365..c726129608 100644 --- a/components/soc/esp32s3/include/soc/soc_pins.h +++ b/components/soc/esp32s3/include/soc/soc_pins.h @@ -16,4 +16,3 @@ #include "soc/gpio_pins.h" #include "soc/spi_pins.h" #include "soc/sdmmc_pins.h" -#include "soc/touch_sensor_pins.h" diff --git a/components/soc/esp32s3/include/soc/touch_sensor_pins.h b/components/soc/esp32s3/include/soc/touch_sensor_pins.h deleted file mode 100644 index 4c553f84b3..0000000000 --- a/components/soc/esp32s3/include/soc/touch_sensor_pins.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - */ - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#define SOC_TOUCH_SHIELD_CHANNEL (14) /*!< The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) */ -#define SOC_TOUCH_DENOISE_CHANNEL (0) /*!< T0 is an internal channel that does not have a corresponding external GPIO. - T0 will work simultaneously with the measured channel Tn. Finally, the actual - measured value of Tn is the value after subtracting lower bits of T0. */ - -#ifdef __cplusplus -} -#endif diff --git a/components/ulp/CMakeLists.txt b/components/ulp/CMakeLists.txt index 53bbed2899..9a6c0ae019 100644 --- a/components/ulp/CMakeLists.txt +++ b/components/ulp/CMakeLists.txt @@ -96,4 +96,9 @@ endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${includes} - REQUIRES esp_adc esp_driver_gpio esp_driver_uart esp_driver_i2s esp_hal_i2c) + REQUIRES esp_adc + esp_driver_gpio + esp_driver_uart + esp_driver_i2s + esp_hal_i2c + esp_hal_touch_sens) diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 17f3ad58e8..b4adc77965 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -495,7 +495,6 @@ components/soc/esp32s2/include/soc/fe_reg.h components/soc/esp32s2/include/soc/memprot_defs.h components/soc/esp32s2/include/soc/nrx_reg.h components/soc/esp32s2/include/soc/soc_ulp.h -components/soc/esp32s2/include/soc/touch_sensor_pins.h components/spi_flash/include/spi_flash_chip_generic.h components/spi_flash/spi_flash_chip_boya.c components/spi_flash/spi_flash_chip_issi.c