From 625a80c5188354a59f4024a413799ea3866325d6 Mon Sep 17 00:00:00 2001 From: Hu Rui Date: Tue, 14 Apr 2026 16:18:07 +0800 Subject: [PATCH] fix(touch_sens): fix typo and chip_rev check in H4/P4 --- .../esp32h4/include/hal/touch_sensor_channel.h | 2 +- .../esp32h4/include/hal/touch_sensor_ll.h | 12 +++--------- .../esp32p4/include/hal/touch_sensor_channel.h | 2 +- .../esp32p4/include/hal/touch_sensor_ll.h | 2 -- .../soc/esp32h4/register/soc/touch_aon_struct.h | 3 +-- components/soc/esp32h4/register/soc/touch_struct.h | 2 +- 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_channel.h b/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_channel.h index 4db058da2e..9f90e99b92 100644 --- a/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_channel.h +++ b/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_channel.h @@ -6,7 +6,7 @@ #pragma once -//Touch channels +// Touch channels #define TOUCH_PAD_GPIO0_CHANNEL 0 #define TOUCH_PAD_NUM0_GPIO_NUM 0 diff --git a/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_ll.h b/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_ll.h index b17726fa37..7e44a1d460 100644 --- a/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_ll.h +++ b/components/esp_hal_touch_sens/esp32h4/include/hal/touch_sensor_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -314,7 +314,6 @@ static inline uint32_t touch_ll_get_chan_active_threshold(uint32_t touch_num, ui __attribute__((always_inline)) static inline void touch_ll_enable_scan_mask(uint16_t chan_mask, bool enable) { - // the lowest bit takes no effect uint16_t mask = chan_mask & TOUCH_LL_FULL_CHANNEL_MASK; uint16_t prev_mask = TOUCH_AON.aon_scan_ctrl1.aon_touch_scan_pad_map; if (enable) { @@ -333,12 +332,9 @@ static inline void touch_ll_enable_scan_mask(uint16_t chan_mask, bool enable) * @note The touch sensor that in scan map, should be deinit GPIO function firstly. * @param enable_mask bitmask of touch sensor scan group. * e.g. TOUCH_PAD_NUM1 -> BIT(1) - * @return - * - ESP_OK on success */ static inline void touch_ll_enable_channel_mask(uint16_t enable_mask) { - // the lowest bit takes no effect uint16_t mask = enable_mask & TOUCH_LL_FULL_CHANNEL_MASK; TOUCH_AON.aon_scan_ctrl1.aon_touch_scan_pad_map = mask; TOUCH_AON.aon_filter2.aon_touch_outen = mask; @@ -596,9 +592,7 @@ static inline uint32_t touch_ll_sample_cfg_get_engaged_num(void) */ static inline void touch_ll_sample_cfg_set_trigger_rise_cnt(uint8_t rise_cnt) { -#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300 - TOUCH_AON.aon_ctrl.aon_freq_scan_cnt_rise = rise_cnt; -#endif + TOUCH_AON.aon_scan_ctrl2.freq_scan_cnt_rise = rise_cnt; } /** @@ -758,7 +752,7 @@ static inline void touch_ll_filter_enable(bool enable) * Force the update the benchmark by software * @note This benchmark will be applied to all enabled channel and all sampling frequency * - * @param pad_num The pad number, range [1-14] + * @param pad_num The pad number, range [0-14] * @param sample_cfg_id The sample configuration index, range [0-2] * @param benchmark The benchmark specified by software */ diff --git a/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_channel.h b/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_channel.h index ff009b31ed..cdc60771a5 100644 --- a/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_channel.h +++ b/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_channel.h @@ -6,7 +6,7 @@ #pragma once -//Touch channels +// Touch channels /* Note: T14 is an internal channel that does not have a corresponding external GPIO. */ diff --git a/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_ll.h b/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_ll.h index 5f8038fda5..811e0f496f 100644 --- a/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_ll.h +++ b/components/esp_hal_touch_sens/esp32p4/include/hal/touch_sensor_ll.h @@ -335,8 +335,6 @@ static inline void touch_ll_enable_scan_mask(uint16_t chan_mask, bool enable) * @note The touch sensor that in scan map, should be deinit GPIO function firstly. * @param enable_mask bitmask of touch sensor scan group. * e.g. TOUCH_PAD_NUM1 -> BIT(1) - * @return - * - ESP_OK on success */ static inline void touch_ll_enable_channel_mask(uint16_t enable_mask) { diff --git a/components/soc/esp32h4/register/soc/touch_aon_struct.h b/components/soc/esp32h4/register/soc/touch_aon_struct.h index b34b47a90a..ec672677c1 100644 --- a/components/soc/esp32h4/register/soc/touch_aon_struct.h +++ b/components/soc/esp32h4/register/soc/touch_aon_struct.h @@ -334,7 +334,7 @@ typedef union { uint32_t val; } touch_aon_approach_reg_t; -/** Type of aon_freq0_scan_para register +/** Type of aon_freq_scan_para register * need_des */ typedef union { @@ -481,7 +481,6 @@ typedef union { uint32_t val; } touch_aon_date_reg_t; - typedef struct { volatile touch_aon_threshold_reg_t thresh[3]; } touch_aon_pad_thresh_reg_t; diff --git a/components/soc/esp32h4/register/soc/touch_struct.h b/components/soc/esp32h4/register/soc/touch_struct.h index cb930def89..9216398622 100644 --- a/components/soc/esp32h4/register/soc/touch_struct.h +++ b/components/soc/esp32h4/register/soc/touch_struct.h @@ -254,7 +254,7 @@ typedef union { uint32_t val; } touch_aprch_ch_data_reg_t; -/** Type of config register +/** Type of sample_status register * need_des */ typedef union {