feat(touch_sens): support touch sensor on esp32s31

This commit is contained in:
Hu Rui
2026-04-07 17:36:08 +08:00
parent 54ecf4c09f
commit b9d3b161e4
22 changed files with 1401 additions and 1118 deletions
@@ -237,9 +237,11 @@ esp_err_t touch_priv_deinit_controller(touch_sensor_handle_t sens_handle)
{
touch_ll_reset_trigger_groups();
/* Disable the additional functions */
#if SOC_TOUCH_SUPPORT_SLEEP_WAKEUP
if (sens_handle->sleep_en) {
touch_sensor_config_sleep_wakeup(sens_handle, NULL);
}
#endif
return ESP_OK;
}
@@ -223,9 +223,11 @@ esp_err_t touch_priv_deinit_controller(touch_sensor_handle_t sens_handle)
if (sens_handle->proximity_en) {
touch_sensor_config_proximity_sensing(sens_handle, NULL);
}
#if SOC_TOUCH_SUPPORT_SLEEP_WAKEUP
if (sens_handle->sleep_en) {
touch_sensor_config_sleep_wakeup(sens_handle, NULL);
}
#endif
if (sens_handle->waterproof_en) {
touch_sensor_config_waterproof(sens_handle, NULL);
}
@@ -238,9 +238,11 @@ esp_err_t touch_priv_deinit_controller(touch_sensor_handle_t sens_handle)
if (sens_handle->proximity_en) {
touch_sensor_config_proximity_sensing(sens_handle, NULL);
}
#if SOC_TOUCH_SUPPORT_SLEEP_WAKEUP
if (sens_handle->sleep_en) {
touch_sensor_config_sleep_wakeup(sens_handle, NULL);
}
#endif
if (sens_handle->waterproof_en) {
touch_sensor_config_waterproof(sens_handle, NULL);
}
@@ -1,3 +1,3 @@
| Supported Targets | ESP32 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- |
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -151,7 +151,16 @@ static bool TEST_TCH_IRAM_ATTR s_test_touch_on_inactive_callback(touch_sensor_ha
static void s_test_touch_simulate_touch(touch_sensor_handle_t touch, touch_channel_handle_t touch_chan, bool active)
{
#if SOC_TOUCH_SENSOR_VERSION <= 2
#if CONFIG_IDF_TARGET_ESP32S31
/* ESP32-S31 has no internal capacitor, emulate touch by changing charging cycles. */
for (int i = 0; i < TOUCH_SAMPLE_CFG_NUM; i++) {
uint32_t charge_times = s_sample_cfg[i].charge_times;
if (active) {
charge_times += charge_times >> 1; // 1.5x
}
touch_ll_set_charge_times(i, charge_times);
}
#elif SOC_TOUCH_SENSOR_VERSION <= 2
touch_chan_info_t chan_info = {};
touch_sensor_get_channel_info(touch_chan, &chan_info);
touch_ll_set_charge_speed(chan_info.chan_id, active ? TOUCH_CHARGE_SPEED_4 : TOUCH_CHARGE_SPEED_7);
@@ -186,10 +195,10 @@ TEST_CASE("touch_sens_active_inactive_test", "[touch]")
touch_sensor_filter_config_t filter_cfg = TOUCH_SENSOR_DEFAULT_FILTER_CONFIG();
TEST_ESP_OK(touch_sensor_config_filter(touch, &filter_cfg));
TEST_ESP_OK(touch_sensor_new_channel(touch, TOUCH_MIN_CHAN_ID, &s_chan_cfg, &touch_chan));
#if SOC_TOUCH_SENSOR_VERSION == 3
#if SOC_TOUCH_SENSOR_VERSION == 3 && !CONFIG_IDF_TARGET_ESP32S31
/* Connect the touch channels to the internal capacitor */
touch_ll_enable_internal_capacitor(true);
#endif // SOC_TOUCH_SENSOR_VERSION == 3
#endif
s_test_touch_do_initial_scanning(touch, 3);
@@ -0,0 +1,51 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
// Touch channels
#define TOUCH_PAD_GPIO6_CHANNEL 0
#define TOUCH_PAD_NUM0_GPIO_NUM 6
#define TOUCH_PAD_GPIO7_CHANNEL 1
#define TOUCH_PAD_NUM1_GPIO_NUM 7
#define TOUCH_PAD_GPIO8_CHANNEL 2
#define TOUCH_PAD_NUM2_GPIO_NUM 8
#define TOUCH_PAD_GPIO9_CHANNEL 3
#define TOUCH_PAD_NUM3_GPIO_NUM 9
#define TOUCH_PAD_GPIO10_CHANNEL 4
#define TOUCH_PAD_NUM4_GPIO_NUM 10
#define TOUCH_PAD_GPIO11_CHANNEL 5
#define TOUCH_PAD_NUM5_GPIO_NUM 11
#define TOUCH_PAD_GPIO12_CHANNEL 6
#define TOUCH_PAD_NUM6_GPIO_NUM 12
#define TOUCH_PAD_GPIO13_CHANNEL 7
#define TOUCH_PAD_NUM7_GPIO_NUM 13
#define TOUCH_PAD_GPIO14_CHANNEL 8
#define TOUCH_PAD_NUM8_GPIO_NUM 14
#define TOUCH_PAD_GPIO15_CHANNEL 9
#define TOUCH_PAD_NUM9_GPIO_NUM 15
#define TOUCH_PAD_GPIO16_CHANNEL 10
#define TOUCH_PAD_NUM10_GPIO_NUM 16
#define TOUCH_PAD_GPIO17_CHANNEL 11
#define TOUCH_PAD_NUM11_GPIO_NUM 17
#define TOUCH_PAD_GPIO18_CHANNEL 12
#define TOUCH_PAD_NUM12_GPIO_NUM 18
#define TOUCH_PAD_GPIO19_CHANNEL 13
#define TOUCH_PAD_NUM13_GPIO_NUM 19
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "hal/touch_sensor_channel.h"
/* Store IO number corresponding to the Touch Sensor channel number. */
const int touch_sensor_channel_io_map[] = {
TOUCH_PAD_NUM0_GPIO_NUM,
TOUCH_PAD_NUM1_GPIO_NUM,
TOUCH_PAD_NUM2_GPIO_NUM,
TOUCH_PAD_NUM3_GPIO_NUM,
TOUCH_PAD_NUM4_GPIO_NUM,
TOUCH_PAD_NUM5_GPIO_NUM,
TOUCH_PAD_NUM6_GPIO_NUM,
TOUCH_PAD_NUM7_GPIO_NUM,
TOUCH_PAD_NUM8_GPIO_NUM,
TOUCH_PAD_NUM9_GPIO_NUM,
TOUCH_PAD_NUM10_GPIO_NUM,
TOUCH_PAD_NUM11_GPIO_NUM,
TOUCH_PAD_NUM12_GPIO_NUM,
TOUCH_PAD_NUM13_GPIO_NUM,
};
@@ -163,6 +163,10 @@ config SOC_SPI_FLASH_SUPPORTED
bool
default y
config SOC_TOUCH_SENSOR_SUPPORTED
bool
default y
config SOC_MODEM_CLOCK_SUPPORTED
bool
default y
@@ -791,6 +795,42 @@ config SOC_ASYNCHRONOUS_BUS_ERROR_MODE
bool
default y
config SOC_TOUCH_SENSOR_VERSION
int
default 3
config SOC_TOUCH_MIN_CHAN_ID
int
default 0
config SOC_TOUCH_MAX_CHAN_ID
int
default 13
config SOC_TOUCH_SUPPORT_SLEEP_WAKEUP
bool
default n
config SOC_TOUCH_SUPPORT_BENCHMARK
bool
default y
config SOC_TOUCH_SUPPORT_WATERPROOF
bool
default y
config SOC_TOUCH_SUPPORT_PROX_SENSING
bool
default y
config SOC_TOUCH_PROXIMITY_CHANNEL_NUM
int
default 3
config SOC_TOUCH_SAMPLE_CFG_NUM
int
default 3
config SOC_PM_SUPPORT_EXT1_WAKEUP
bool
default y
+15 -1
View File
@@ -90,7 +90,7 @@
#define SOC_WDT_SUPPORTED 1
#define SOC_RTC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 // TODO: [ESP32S31] IDF-14777
// #define SOC_TOUCH_SENSOR_SUPPORTED 1 // TODO: [ESP32S31] IDF-14796
#define SOC_TOUCH_SENSOR_SUPPORTED 1
// #define SOC_RNG_SUPPORTED 1 // TODO: [ESP32S31] IDF-14632
// #define SOC_PPA_SUPPORTED 1 // TODO: [ESP32S31] IDF-14769
// #define SOC_LIGHT_SLEEP_SUPPORTED 1 // TODO: [ESP32S31] IDF-14645
@@ -373,6 +373,20 @@
#define SOC_RCC_IS_INDEPENDENT 1 /*!< Reset and Clock Control has own registers for each module */
/*-------------------------- Memory CAPS --------------------------*/
#define SOC_ASYNCHRONOUS_BUS_ERROR_MODE (1)
/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/
#define SOC_TOUCH_SENSOR_VERSION (3) /*!< Hardware version of touch sensor */
#define SOC_TOUCH_MIN_CHAN_ID (0U) /*!< Touch minimum channel number */
#define SOC_TOUCH_MAX_CHAN_ID (13) /*!< Touch maximum channel number */
/* Touch Sensor Features */
#define SOC_TOUCH_SUPPORT_SLEEP_WAKEUP (0) /*!< Touch sensor supports sleep awake */
#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_PROX_SENSING (1) /*!< Touch sensor supports proximity sensing */
#define SOC_TOUCH_PROXIMITY_CHANNEL_NUM (3) /*!< Support touch proximity channel number. */
#define SOC_TOUCH_SAMPLE_CFG_NUM (3) /*!< The sample configurations number in total, each sampler can be used to sample on one frequency */
/*-------------------------- Power Management CAPS ----------------------------*/
#define SOC_PM_SUPPORT_EXT1_WAKEUP (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN (1) /*!<Supports one bit per pin to configure the EXT1 trigger level */
@@ -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 OR MIT
*/
@@ -334,107 +334,39 @@ typedef union {
uint32_t val;
} touch_aon_approach_reg_t;
/** Type of freq0_scan_para register
/** Type of aon_freq_scan_para register
* need_des
*/
typedef union {
struct {
/** touch_freq0_dcap_lpf : R/W; bitpos: [6:0]; default: 0;
/** touch_freq_dcap_lpf : R/W; bitpos: [6:0]; default: 0;
* need_des
*/
uint32_t touch_freq0_dcap_lpf:7;
/** touch_freq0_dres_lpf : R/W; bitpos: [8:7]; default: 0;
uint32_t touch_freq_dcap_lpf:7;
/** touch_freq_dres_lpf : R/W; bitpos: [8:7]; default: 0;
* need_des
*/
uint32_t touch_freq0_dres_lpf:2;
/** touch_freq0_drv_ls : R/W; bitpos: [12:9]; default: 0;
uint32_t touch_freq_dres_lpf:2;
/** touch_freq_drv_ls : R/W; bitpos: [12:9]; default: 0;
* need_des
*/
uint32_t touch_freq0_drv_ls:4;
/** touch_freq0_drv_hs : R/W; bitpos: [17:13]; default: 0;
uint32_t touch_freq_drv_ls:4;
/** touch_freq_drv_hs : R/W; bitpos: [17:13]; default: 0;
* need_des
*/
uint32_t touch_freq0_drv_hs:5;
/** touch_freq0_dbias : R/W; bitpos: [22:18]; default: 0;
uint32_t touch_freq_drv_hs:5;
/** touch_freq_dbias : R/W; bitpos: [22:18]; default: 0;
* need_des
*/
uint32_t touch_freq0_dbias:5;
/** touch_freq0_buf_sel_en : R/W; bitpos: [23]; default: 1;
uint32_t touch_freq_dbias:5;
/** touch_freq_buf_sel_en : R/W; bitpos: [23]; default: 1;
* need_des
*/
uint32_t touch_freq0_buf_sel_en:1;
uint32_t touch_freq_buf_sel_en:1;
uint32_t reserved_24:8;
};
uint32_t val;
} touch_aon_freq0_scan_para_reg_t;
/** Type of freq1_scan_para register
* need_des
*/
typedef union {
struct {
/** touch_freq1_dcap_lpf : R/W; bitpos: [6:0]; default: 0;
* need_des
*/
uint32_t touch_freq1_dcap_lpf:7;
/** touch_freq1_dres_lpf : R/W; bitpos: [8:7]; default: 0;
* need_des
*/
uint32_t touch_freq1_dres_lpf:2;
/** touch_freq1_drv_ls : R/W; bitpos: [12:9]; default: 0;
* need_des
*/
uint32_t touch_freq1_drv_ls:4;
/** touch_freq1_drv_hs : R/W; bitpos: [17:13]; default: 0;
* need_des
*/
uint32_t touch_freq1_drv_hs:5;
/** touch_freq1_dbias : R/W; bitpos: [22:18]; default: 0;
* need_des
*/
uint32_t touch_freq1_dbias:5;
/** touch_freq1_buf_sel_en : R/W; bitpos: [23]; default: 1;
* need_des
*/
uint32_t touch_freq1_buf_sel_en:1;
uint32_t reserved_24:8;
};
uint32_t val;
} touch_aon_freq1_scan_para_reg_t;
/** Type of freq2_scan_para register
* need_des
*/
typedef union {
struct {
/** touch_freq2_dcap_lpf : R/W; bitpos: [6:0]; default: 0;
* need_des
*/
uint32_t touch_freq2_dcap_lpf:7;
/** touch_freq2_dres_lpf : R/W; bitpos: [8:7]; default: 0;
* need_des
*/
uint32_t touch_freq2_dres_lpf:2;
/** touch_freq2_drv_ls : R/W; bitpos: [12:9]; default: 0;
* need_des
*/
uint32_t touch_freq2_drv_ls:4;
/** touch_freq2_drv_hs : R/W; bitpos: [17:13]; default: 0;
* need_des
*/
uint32_t touch_freq2_drv_hs:5;
/** touch_freq2_dbias : R/W; bitpos: [22:18]; default: 0;
* need_des
*/
uint32_t touch_freq2_dbias:5;
/** touch_freq2_buf_sel_en : R/W; bitpos: [23]; default: 1;
* need_des
*/
uint32_t touch_freq2_buf_sel_en:1;
uint32_t reserved_24:8;
};
uint32_t val;
} touch_aon_freq2_scan_para_reg_t;
} touch_aon_freq_scan_para_reg_t;
/** Type of ana_para register
* need_des
@@ -526,635 +458,19 @@ typedef union {
uint32_t val;
} touch_aon_mux1_reg_t;
/** Type of pad0_th0 register
/** Type of threshold register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad0_th0 : R/W; bitpos: [31:16]; default: 0;
/** threshold : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad0_th0:16;
uint32_t threshold:16;
};
uint32_t val;
} touch_aon_pad0_th0_reg_t;
/** Type of pad0_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad0_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad0_th1:16;
};
uint32_t val;
} touch_aon_pad0_th1_reg_t;
/** Type of pad0_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad0_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad0_th2:16;
};
uint32_t val;
} touch_aon_pad0_th2_reg_t;
/** Type of pad1_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad1_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad1_th0:16;
};
uint32_t val;
} touch_aon_pad1_th0_reg_t;
/** Type of pad1_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad1_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad1_th1:16;
};
uint32_t val;
} touch_aon_pad1_th1_reg_t;
/** Type of pad1_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad1_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad1_th2:16;
};
uint32_t val;
} touch_aon_pad1_th2_reg_t;
/** Type of pad2_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad2_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad2_th0:16;
};
uint32_t val;
} touch_aon_pad2_th0_reg_t;
/** Type of pad2_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad2_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad2_th1:16;
};
uint32_t val;
} touch_aon_pad2_th1_reg_t;
/** Type of pad2_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad2_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad2_th2:16;
};
uint32_t val;
} touch_aon_pad2_th2_reg_t;
/** Type of pad3_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad3_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad3_th0:16;
};
uint32_t val;
} touch_aon_pad3_th0_reg_t;
/** Type of pad3_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad3_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad3_th1:16;
};
uint32_t val;
} touch_aon_pad3_th1_reg_t;
/** Type of pad3_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad3_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad3_th2:16;
};
uint32_t val;
} touch_aon_pad3_th2_reg_t;
/** Type of pad4_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad4_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad4_th0:16;
};
uint32_t val;
} touch_aon_pad4_th0_reg_t;
/** Type of pad4_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad4_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad4_th1:16;
};
uint32_t val;
} touch_aon_pad4_th1_reg_t;
/** Type of pad4_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad4_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad4_th2:16;
};
uint32_t val;
} touch_aon_pad4_th2_reg_t;
/** Type of pad5_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad5_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad5_th0:16;
};
uint32_t val;
} touch_aon_pad5_th0_reg_t;
/** Type of pad5_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad5_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad5_th1:16;
};
uint32_t val;
} touch_aon_pad5_th1_reg_t;
/** Type of pad5_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad5_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad5_th2:16;
};
uint32_t val;
} touch_aon_pad5_th2_reg_t;
/** Type of pad6_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad6_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad6_th0:16;
};
uint32_t val;
} touch_aon_pad6_th0_reg_t;
/** Type of pad6_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad6_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad6_th1:16;
};
uint32_t val;
} touch_aon_pad6_th1_reg_t;
/** Type of pad6_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad6_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad6_th2:16;
};
uint32_t val;
} touch_aon_pad6_th2_reg_t;
/** Type of pad7_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad7_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad7_th0:16;
};
uint32_t val;
} touch_aon_pad7_th0_reg_t;
/** Type of pad7_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad7_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad7_th1:16;
};
uint32_t val;
} touch_aon_pad7_th1_reg_t;
/** Type of pad7_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad7_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad7_th2:16;
};
uint32_t val;
} touch_aon_pad7_th2_reg_t;
/** Type of pad8_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad8_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad8_th0:16;
};
uint32_t val;
} touch_aon_pad8_th0_reg_t;
/** Type of pad8_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad8_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad8_th1:16;
};
uint32_t val;
} touch_aon_pad8_th1_reg_t;
/** Type of pad8_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad8_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad8_th2:16;
};
uint32_t val;
} touch_aon_pad8_th2_reg_t;
/** Type of pad9_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad9_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad9_th0:16;
};
uint32_t val;
} touch_aon_pad9_th0_reg_t;
/** Type of pad9_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad9_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad9_th1:16;
};
uint32_t val;
} touch_aon_pad9_th1_reg_t;
/** Type of pad9_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad9_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad9_th2:16;
};
uint32_t val;
} touch_aon_pad9_th2_reg_t;
/** Type of pad10_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad10_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad10_th0:16;
};
uint32_t val;
} touch_aon_pad10_th0_reg_t;
/** Type of pad10_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad10_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad10_th1:16;
};
uint32_t val;
} touch_aon_pad10_th1_reg_t;
/** Type of pad10_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad10_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad10_th2:16;
};
uint32_t val;
} touch_aon_pad10_th2_reg_t;
/** Type of pad11_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad11_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad11_th0:16;
};
uint32_t val;
} touch_aon_pad11_th0_reg_t;
/** Type of pad11_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad11_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad11_th1:16;
};
uint32_t val;
} touch_aon_pad11_th1_reg_t;
/** Type of pad11_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad11_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad11_th2:16;
};
uint32_t val;
} touch_aon_pad11_th2_reg_t;
/** Type of pad12_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad12_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad12_th0:16;
};
uint32_t val;
} touch_aon_pad12_th0_reg_t;
/** Type of pad12_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad12_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad12_th1:16;
};
uint32_t val;
} touch_aon_pad12_th1_reg_t;
/** Type of pad12_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad12_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad12_th2:16;
};
uint32_t val;
} touch_aon_pad12_th2_reg_t;
/** Type of pad13_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad13_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad13_th0:16;
};
uint32_t val;
} touch_aon_pad13_th0_reg_t;
/** Type of pad13_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad13_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad13_th1:16;
};
uint32_t val;
} touch_aon_pad13_th1_reg_t;
/** Type of pad13_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad13_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad13_th2:16;
};
uint32_t val;
} touch_aon_pad13_th2_reg_t;
/** Type of pad14_th0 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad14_th0 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad14_th0:16;
};
uint32_t val;
} touch_aon_pad14_th0_reg_t;
/** Type of pad14_th1 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad14_th1 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad14_th1:16;
};
uint32_t val;
} touch_aon_pad14_th1_reg_t;
/** Type of pad14_th2 register
* need_des
*/
typedef union {
struct {
uint32_t reserved_0:16;
/** touch_pad14_th2 : R/W; bitpos: [31:16]; default: 0;
* Reserved
*/
uint32_t touch_pad14_th2:16;
};
uint32_t val;
} touch_aon_pad14_th2_reg_t;
} touch_aon_threshold_reg_t;
/** Type of date register
* need_des
@@ -1173,6 +489,9 @@ 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;
typedef struct {
volatile touch_aon_approach_work_meas_num_reg_t approach_work_meas_num;
@@ -1187,60 +506,15 @@ typedef struct {
volatile touch_aon_slp1_reg_t slp1;
volatile touch_aon_clr_reg_t clr;
volatile touch_aon_approach_reg_t approach;
volatile touch_aon_freq0_scan_para_reg_t freq0_scan_para;
volatile touch_aon_freq1_scan_para_reg_t freq1_scan_para;
volatile touch_aon_freq2_scan_para_reg_t freq2_scan_para;
volatile touch_aon_freq_scan_para_reg_t freq_scan_para[3];
volatile touch_aon_ana_para_reg_t ana_para;
volatile touch_aon_mux0_reg_t mux0;
volatile touch_aon_mux1_reg_t mux1;
volatile touch_aon_pad0_th0_reg_t pad0_th0;
volatile touch_aon_pad0_th1_reg_t pad0_th1;
volatile touch_aon_pad0_th2_reg_t pad0_th2;
volatile touch_aon_pad1_th0_reg_t pad1_th0;
volatile touch_aon_pad1_th1_reg_t pad1_th1;
volatile touch_aon_pad1_th2_reg_t pad1_th2;
volatile touch_aon_pad2_th0_reg_t pad2_th0;
volatile touch_aon_pad2_th1_reg_t pad2_th1;
volatile touch_aon_pad2_th2_reg_t pad2_th2;
volatile touch_aon_pad3_th0_reg_t pad3_th0;
volatile touch_aon_pad3_th1_reg_t pad3_th1;
volatile touch_aon_pad3_th2_reg_t pad3_th2;
volatile touch_aon_pad4_th0_reg_t pad4_th0;
volatile touch_aon_pad4_th1_reg_t pad4_th1;
volatile touch_aon_pad4_th2_reg_t pad4_th2;
volatile touch_aon_pad5_th0_reg_t pad5_th0;
volatile touch_aon_pad5_th1_reg_t pad5_th1;
volatile touch_aon_pad5_th2_reg_t pad5_th2;
volatile touch_aon_pad6_th0_reg_t pad6_th0;
volatile touch_aon_pad6_th1_reg_t pad6_th1;
volatile touch_aon_pad6_th2_reg_t pad6_th2;
volatile touch_aon_pad7_th0_reg_t pad7_th0;
volatile touch_aon_pad7_th1_reg_t pad7_th1;
volatile touch_aon_pad7_th2_reg_t pad7_th2;
volatile touch_aon_pad8_th0_reg_t pad8_th0;
volatile touch_aon_pad8_th1_reg_t pad8_th1;
volatile touch_aon_pad8_th2_reg_t pad8_th2;
volatile touch_aon_pad9_th0_reg_t pad9_th0;
volatile touch_aon_pad9_th1_reg_t pad9_th1;
volatile touch_aon_pad9_th2_reg_t pad9_th2;
volatile touch_aon_pad10_th0_reg_t pad10_th0;
volatile touch_aon_pad10_th1_reg_t pad10_th1;
volatile touch_aon_pad10_th2_reg_t pad10_th2;
volatile touch_aon_pad11_th0_reg_t pad11_th0;
volatile touch_aon_pad11_th1_reg_t pad11_th1;
volatile touch_aon_pad11_th2_reg_t pad11_th2;
volatile touch_aon_pad12_th0_reg_t pad12_th0;
volatile touch_aon_pad12_th1_reg_t pad12_th1;
volatile touch_aon_pad12_th2_reg_t pad12_th2;
volatile touch_aon_pad13_th0_reg_t pad13_th0;
volatile touch_aon_pad13_th1_reg_t pad13_th1;
volatile touch_aon_pad13_th2_reg_t pad13_th2;
volatile touch_aon_pad14_th0_reg_t pad14_th0;
volatile touch_aon_pad14_th1_reg_t pad14_th1;
volatile touch_aon_pad14_th2_reg_t pad14_th2;
volatile touch_aon_pad_thresh_reg_t padx_thn[15];
volatile touch_aon_date_reg_t date;
} touch_aon_dev_t;
extern touch_aon_dev_t TOUCH_AON;
#ifndef __cplusplus
_Static_assert(sizeof(touch_aon_dev_t) == 0x100, "Invalid size of touch_aon_dev_t structure");
@@ -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 OR MIT
*/
@@ -40,10 +40,10 @@ typedef union {
* need_des
*/
uint32_t approach_loop_done_int_raw:1;
/** baseline_update_int_raw : R/WTC/SS; bitpos: [6]; default: 0;
/** benchmark_update_int_raw : R/WTC/SS; bitpos: [6]; default: 0;
* need_des
*/
uint32_t baseline_update_int_raw:1;
uint32_t benchmark_update_int_raw:1;
uint32_t reserved_7:25;
};
uint32_t val;
@@ -78,10 +78,10 @@ typedef union {
* need_des
*/
uint32_t approach_loop_done_int_st:1;
/** baseline_update_int_st : RO; bitpos: [6]; default: 0;
/** benchmark_update_int_st : RO; bitpos: [6]; default: 0;
* need_des
*/
uint32_t baseline_update_int_st:1;
uint32_t benchmark_update_int_st:1;
uint32_t reserved_7:25;
};
uint32_t val;
@@ -116,10 +116,10 @@ typedef union {
* need_des
*/
uint32_t approach_loop_done_int_ena:1;
/** baseline_update_int_ena : R/W; bitpos: [6]; default: 0;
/** benchmark_update_int_ena : R/W; bitpos: [6]; default: 0;
* need_des
*/
uint32_t baseline_update_int_ena:1;
uint32_t benchmark_update_int_ena:1;
uint32_t reserved_7:25;
};
uint32_t val;
@@ -154,10 +154,10 @@ typedef union {
* need_des
*/
uint32_t approach_loop_done_int_clr:1;
/** baseline_update_int_clr : WT; bitpos: [6]; default: 0;
/** benchmark_update_int_clr : WT; bitpos: [6]; default: 0;
* need_des
*/
uint32_t baseline_update_int_clr:1;
uint32_t benchmark_update_int_clr:1;
uint32_t reserved_7:25;
};
uint32_t val;
@@ -185,337 +185,29 @@ typedef union {
uint32_t val;
} touch_chn_status_reg_t;
/** Type of status_0 register
/** Type of chn_data register
* need_des
*/
typedef union {
struct {
/** pad0_data : RO; bitpos: [15:0]; default: 0;
/** pad_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad0_data:16;
/** pad0_debounce_cnt : RO; bitpos: [18:16]; default: 0;
uint32_t pad_data:16;
/** pad_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad0_debounce_cnt:3;
/** pad0_nn_cnt : RO; bitpos: [22:19]; default: 0;
uint32_t pad_debounce_cnt:3;
/** pad_neg_noise_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad0_nn_cnt:4;
uint32_t pad_neg_noise_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_0_reg_t;
} touch_chn_data_reg_t;
/** Type of status_1 register
* need_des
*/
typedef union {
struct {
/** pad1_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad1_data:16;
/** pad1_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad1_debounce_cnt:3;
/** pad1_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad1_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_1_reg_t;
/** Type of status_2 register
* need_des
*/
typedef union {
struct {
/** pad2_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad2_data:16;
/** pad2_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad2_debounce_cnt:3;
/** pad2_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad2_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_2_reg_t;
/** Type of status_3 register
* need_des
*/
typedef union {
struct {
/** pad3_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad3_data:16;
/** pad3_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad3_debounce_cnt:3;
/** pad3_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad3_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_3_reg_t;
/** Type of status_4 register
* need_des
*/
typedef union {
struct {
/** pad4_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad4_data:16;
/** pad4_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad4_debounce_cnt:3;
/** pad4_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad4_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_4_reg_t;
/** Type of status_5 register
* need_des
*/
typedef union {
struct {
/** pad5_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad5_data:16;
/** pad5_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad5_debounce_cnt:3;
/** pad5_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad5_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_5_reg_t;
/** Type of status_6 register
* need_des
*/
typedef union {
struct {
/** pad6_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad6_data:16;
/** pad6_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad6_debounce_cnt:3;
/** pad6_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad6_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_6_reg_t;
/** Type of status_7 register
* need_des
*/
typedef union {
struct {
/** pad7_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad7_data:16;
/** pad7_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad7_debounce_cnt:3;
/** pad7_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad7_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_7_reg_t;
/** Type of status_8 register
* need_des
*/
typedef union {
struct {
/** pad8_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad8_data:16;
/** pad8_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad8_debounce_cnt:3;
/** pad8_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad8_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_8_reg_t;
/** Type of status_9 register
* need_des
*/
typedef union {
struct {
/** pad9_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad9_data:16;
/** pad9_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad9_debounce_cnt:3;
/** pad9_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad9_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_9_reg_t;
/** Type of status_10 register
* need_des
*/
typedef union {
struct {
/** pad10_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad10_data:16;
/** pad10_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad10_debounce_cnt:3;
/** pad10_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad10_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_10_reg_t;
/** Type of status_11 register
* need_des
*/
typedef union {
struct {
/** pad11_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad11_data:16;
/** pad11_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad11_debounce_cnt:3;
/** pad11_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad11_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_11_reg_t;
/** Type of status_12 register
* need_des
*/
typedef union {
struct {
/** pad12_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad12_data:16;
/** pad12_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad12_debounce_cnt:3;
/** pad12_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad12_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_12_reg_t;
/** Type of status_13 register
* need_des
*/
typedef union {
struct {
/** pad13_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad13_data:16;
/** pad13_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad13_debounce_cnt:3;
/** pad13_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad13_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_13_reg_t;
/** Type of status_14 register
* need_des
*/
typedef union {
struct {
/** pad14_data : RO; bitpos: [15:0]; default: 0;
* need_des
*/
uint32_t pad14_data:16;
/** pad14_debounce_cnt : RO; bitpos: [18:16]; default: 0;
* need_des
*/
uint32_t pad14_debounce_cnt:3;
/** pad14_nn_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t pad14_nn_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_14_reg_t;
/** Type of status_15 register
/** Type of slp_ch_data register
* need_des
*/
typedef union {
@@ -528,16 +220,16 @@ typedef union {
* need_des
*/
uint32_t slp_debounce_cnt:3;
/** slp_nn_cnt : RO; bitpos: [22:19]; default: 0;
/** slp_neg_noise_cnt : RO; bitpos: [22:19]; default: 0;
* need_des
*/
uint32_t slp_nn_cnt:4;
uint32_t slp_neg_noise_cnt:4;
uint32_t reserved_23:9;
};
uint32_t val;
} touch_status_15_reg_t;
} touch_slp_ch_data_reg_t;
/** Type of status_16 register
/** Type of aprch_ch_data register
* need_des
*/
typedef union {
@@ -560,9 +252,9 @@ typedef union {
uint32_t slp_approach_cnt:8;
};
uint32_t val;
} touch_status_16_reg_t;
} touch_aprch_ch_data_reg_t;
/** Type of status_17 register
/** Type of sample_status register
* need_des
*/
typedef union {
@@ -594,7 +286,7 @@ typedef union {
uint32_t reserved_25:7;
};
uint32_t val;
} touch_status_17_reg_t;
} touch_sample_status_reg_t;
/** Type of chn_tmp_status register
* need_des
@@ -637,29 +329,16 @@ typedef struct {
volatile touch_int_ena_reg_t int_ena;
volatile touch_int_clr_reg_t int_clr;
volatile touch_chn_status_reg_t chn_status;
volatile touch_status_0_reg_t status_0;
volatile touch_status_1_reg_t status_1;
volatile touch_status_2_reg_t status_2;
volatile touch_status_3_reg_t status_3;
volatile touch_status_4_reg_t status_4;
volatile touch_status_5_reg_t status_5;
volatile touch_status_6_reg_t status_6;
volatile touch_status_7_reg_t status_7;
volatile touch_status_8_reg_t status_8;
volatile touch_status_9_reg_t status_9;
volatile touch_status_10_reg_t status_10;
volatile touch_status_11_reg_t status_11;
volatile touch_status_12_reg_t status_12;
volatile touch_status_13_reg_t status_13;
volatile touch_status_14_reg_t status_14;
volatile touch_status_15_reg_t status_15;
volatile touch_status_16_reg_t status_16;
volatile touch_status_17_reg_t status_17;
volatile touch_chn_data_reg_t chn_data[15];
volatile touch_slp_ch_data_reg_t slp_ch_data;
volatile touch_aprch_ch_data_reg_t aprch_ch_data;
volatile touch_sample_status_reg_t sample_status;
volatile touch_chn_tmp_status_reg_t chn_tmp_status;
uint32_t reserved_060[40];
volatile touch_date_reg_t date;
} touch_dev_t;
extern touch_dev_t TOUCH_SENS;
#ifndef __cplusplus
_Static_assert(sizeof(touch_dev_t) == 0x104, "Invalid size of touch_dev_t structure");
+3
View File
@@ -3,3 +3,6 @@ INPUT += \
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_decode.h \
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_encode.h \
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_types.h \
$(PROJECT_PATH)/components/esp_driver_touch_sens/hw_ver3/include/driver/touch_version_types.h \
$(PROJECT_PATH)/components/esp_driver_touch_sens/include/driver/touch_sens.h \
$(PROJECT_PATH)/components/esp_driver_touch_sens/include/driver/touch_sens_types.h
@@ -3,7 +3,7 @@ Capacitive Touch Sensor
:link_to_translation:`zh_CN:[中文]`
{IDF_TARGET_TOUCH_SENSOR_VERSION:default="NOT_UPDATED", esp32="v1", esp32s2="v2", esp32s3="v2", esp32p4="v3", esp32h4="v3"}
{IDF_TARGET_TOUCH_SENSOR_VERSION:default="NOT_UPDATED", esp32="v1", esp32s2="v2", esp32s3="v2", esp32p4="v3", esp32h4="v3", esp32s31="v3"}
Introduction
---------------
@@ -31,6 +31,7 @@ Overview of Capacitive Touch Sensor Versions
+------------------+-----------+---------------------------------------------------------------------------------------+
| V3 | ESP32-P4 | Version 3, support frequency hopping |
| | ESP32-H4 | |
| | ESP32-S31 | |
+------------------+-----------+---------------------------------------------------------------------------------------+
Measurement Principle
@@ -0,0 +1,61 @@
.. This file gets included from other .rst files in this folder.
.. It contains target-specific snippets.
.. Comments and '---' lines act as delimiters.
..
.. This is necessary mainly because RST doesn't support substitutions
.. (defined in RST, not in Python) inside code blocks. If that is ever implemented,
.. These code blocks can be moved back to the main .rst files, with target-specific
.. file names being replaced by substitutions.
.. touch-chan-mapping
.. list-table::
:header-rows: 1
:widths: 20 20
* - Channel
- GPIO
* - CH0
- IO6
* - CH1
- IO7
* - CH2
- IO8
* - CH3
- IO9
* - CH4
- IO10
* - CH5
- IO11
* - CH6
- IO12
* - CH7
- IO13
* - CH8
- IO14
* - CH9
- IO15
* - CH10
- IO16
* - CH11
- IO17
* - CH12
- IO18
* - CH13
- IO19
---
@@ -3,7 +3,7 @@
:link_to_translation:`en:[English]`
{IDF_TARGET_TOUCH_SENSOR_VERSION:default="NOT_UPDATED", esp32="v1", esp32s2="v2", esp32s3="v2", esp32p4="v3", esp32h4="v3"}
{IDF_TARGET_TOUCH_SENSOR_VERSION:default="NOT_UPDATED", esp32="v1", esp32s2="v2", esp32s3="v2", esp32p4="v3", esp32h4="v3", esp32s31="v3"}
概述
------
@@ -31,6 +31,7 @@
+-----------+--------------+------------------------------------------------------------------------+
| V3 | ESP32-P4 | 第三代触摸传感器,新增跳频扫描 |
| | ESP32-H4 | |
| | ESP32-S31 | |
+-----------+--------------+------------------------------------------------------------------------+
测量原理
@@ -0,0 +1,61 @@
.. This file gets included from other .rst files in this folder.
.. It contains target-specific snippets.
.. Comments and '---' lines act as delimiters.
..
.. This is necessary mainly because RST doesn't support substitutions
.. (defined in RST, not in Python) inside code blocks. If that is ever implemented,
.. These code blocks can be moved back to the main .rst files, with target-specific
.. file names being replaced by substitutions.
.. touch-chan-mapping
.. list-table::
:header-rows: 1
:widths: 20 20
* - 通道
- GPIO
* - CH0
- IO6
* - CH1
- IO7
* - CH2
- IO8
* - CH3
- IO9
* - CH4
- IO10
* - CH5
- IO11
* - CH6
- IO12
* - CH7
- IO13
* - CH8
- IO14
* - CH9
- IO15
* - CH10
- IO16
* - CH11
- IO17
* - CH12
- IO18
* - CH13
- IO19
---
+1 -1
View File
@@ -710,7 +710,7 @@ examples/peripherals/touch_sensor/touch_sens_basic:
examples/peripherals/touch_sensor/touch_sens_sleep:
disable:
- if: SOC_TOUCH_SENSOR_SUPPORTED != 1 or SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP != 1
- if: SOC_TOUCH_SENSOR_SUPPORTED != 1 or SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP != 1 or SOC_TOUCH_SUPPORT_SLEEP_WAKEUP != 1
depends_components:
- esp_driver_touch_sens
- esp_hal_touch_sens
+1 -1
View File
@@ -2,4 +2,4 @@
| ------- | ----------------- |
| V1 | ESP32 |
| V2 | ESP32S2, ESP32S3 |
| V3 | ESP32P4 |
| V3 | ESP32P4, ESP32H4, ESP32S31 |
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- |
# Capacity Touch Sensor Example
@@ -6,7 +6,7 @@ from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.generic
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32s3', 'esp32p4', 'esp32s31'], indirect=['target'])
def test_touch_sens(dut: Dut) -> None:
dut.expect(r'Touch \[CH [0-9]+\] enabled on GPIO[0-9]+')
dut.expect_exact('Initial benchmark and new threshold are:')
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import pytest
from pytest_embedded import Dut
@@ -17,7 +17,11 @@ from pytest_embedded_idf.utils import soc_filtered_targets
)
@idf_parametrize(
'target',
soc_filtered_targets('SOC_TOUCH_SENSOR_SUPPORTED == 1 and SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP == 1'),
soc_filtered_targets(
'SOC_TOUCH_SENSOR_SUPPORTED == 1 and '
'SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP == 1 and '
'SOC_TOUCH_SUPPORT_SLEEP_WAKEUP == 1'
),
indirect=['target'],
)
def test_touch_sens_sleep(dut: Dut) -> None: