mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
feat(hal): graudate the touch sensor hal driver into a new component
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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}
|
||||
)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
+1
-1
@@ -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" {
|
||||
+10
-8
@@ -18,7 +18,7 @@
|
||||
#include <stdbool.h>
|
||||
#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 <<n) | (0x1 << m))))
|
||||
#define TOUCH_LL_BITS_SWAP(v) TOUCH_LL_BIT_SWAP(v, 8, 9)
|
||||
#define TOUCH_LL_CHAN_SWAP(chan) ((chan) == 8 ? 9 : ((chan) == 9 ? 8 : (chan)))
|
||||
#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_READ_RAW 0x0
|
||||
|
||||
#define TOUCH_LL_CHARGE_DURATION_MAX (0xFFFF)
|
||||
@@ -392,7 +395,6 @@ static inline bool touch_ll_is_fsm_repeated_timer_enabled(void)
|
||||
return (bool)RTCCNTL.state0.touch_slp_timer_en;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enable the touch sensor FSM start signal from software
|
||||
*/
|
||||
@@ -431,7 +433,7 @@ __attribute__((always_inline))
|
||||
static inline void touch_ll_read_chan_data(uint32_t touch_num, uint8_t type, uint32_t *data)
|
||||
{
|
||||
HAL_ASSERT(type == TOUCH_LL_READ_RAW);
|
||||
HAL_ASSERT(touch_num < SOC_MODULE_ATTR(TOUCH, CHAN_NUM));
|
||||
HAL_ASSERT(touch_num < TOUCH_LL_GET(CHAN_NUM));
|
||||
touch_num = TOUCH_LL_CHAN_SWAP(touch_num);
|
||||
if (touch_num & 0x1) {
|
||||
*data = HAL_FORCE_READ_U32_REG_FIELD(SENS.touch_meas[touch_num >> 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
|
||||
+1
-1
@@ -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)
|
||||
+1
-1
@@ -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"
|
||||
+91
-88
@@ -16,7 +16,7 @@
|
||||
#include <stdbool.h>
|
||||
#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();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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"
|
||||
+1
-1
@@ -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" {
|
||||
+22
-16
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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"
|
||||
+1
-1
@@ -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" {
|
||||
+22
-18
@@ -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.
|
||||
*
|
||||
+4
-4
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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"
|
||||
+1
-2
@@ -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,
|
||||
+1
-1
@@ -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
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
#include "hal/touch_sensor_legacy_types.h"
|
||||
#include "hal/gpio_types.h"
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user