feat(touch): support touch v1 in new touch driver

This commit is contained in:
laokaiyao
2025-01-10 16:42:22 +08:00
parent 057bae82e1
commit fd7b80833c
39 changed files with 1950 additions and 631 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -195,6 +195,22 @@ static inline void touch_ll_set_chan_active_threshold(uint32_t touch_num, uint32
SENS.touch_thresh[touch_num - 1].thresh = thresh;
}
/**
* Get touch sensor threshold of charge cycles that triggers pad active state.
* The threshold determines the sensitivity of the touch sensor.
* The threshold is the original value of the trigger state minus the benchmark value.
*
* @note If set "TOUCH_PAD_THRESHOLD_MAX", the touch is never be triggered.
* @param touch_num The touch pad id
* @return
* - The threshold of charge cycles
*/
static inline uint32_t touch_ll_get_chan_active_threshold(uint32_t touch_num)
{
HAL_ASSERT(touch_num > 0);
return SENS.touch_thresh[touch_num - 1].thresh;
}
/**
* Set the power on wait cycle
*
@@ -609,6 +625,17 @@ static inline void touch_ll_sleep_set_channel_num(uint32_t touch_num)
RTCCNTL.touch_slp_thres.touch_slp_pad = touch_num;
}
/**
* Get touch channel number for sleep pad.
*
* @note Only one touch sensor channel is supported in deep sleep mode.
* @param touch_num Touch sensor channel number.
*/
static inline void touch_ll_sleep_get_channel_num(uint32_t *touch_num)
{
*touch_num = RTCCNTL.touch_slp_thres.touch_slp_pad;
}
/**
* Enable proximity sensing function for sleep channel.
*/
@@ -1646,17 +1673,6 @@ static inline bool touch_ll_proximity_pad_check(touch_pad_t touch_num)
}
/************** sleep pad setting ***********************/
/**
* Get touch channel number for sleep pad.
*
* @note Only one touch sensor channel is supported in deep sleep mode.
* @param touch_num Touch sensor channel number.
*/
static inline void touch_ll_sleep_get_channel_num(touch_pad_t *touch_num)
{
*touch_num = (touch_pad_t)(RTCCNTL.touch_slp_thres.touch_slp_pad);
}
/**
* Get the trigger threshold of touch sensor in deep sleep.
* The threshold determines the sensitivity of the touch sensor.
+1 -1
View File
@@ -152,7 +152,7 @@ void touch_hal_sleep_channel_enable(touch_pad_t pad_num, bool enable)
void touch_hal_sleep_channel_get_config(touch_pad_sleep_channel_t *slp_config)
{
touch_ll_sleep_get_channel_num(&slp_config->touch_num);
touch_ll_sleep_get_channel_num((uint32_t *)&slp_config->touch_num);
slp_config->en_proximity = touch_ll_sleep_is_proximity_enabled();
}