mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
feat(ulp_touch): support ulp touch driver on p4
This commit is contained in:
@@ -584,6 +584,18 @@ static inline void touch_ll_sample_cfg_set_engaged_num(uint8_t sample_cfg_num)
|
||||
LP_ANA_PERI.touch_scan_ctrl2.freq_scan_cnt_limit = sample_cfg_num ? sample_cfg_num : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the engaged sample configuration number
|
||||
*
|
||||
* @return The engaged sample configuration number, range 0~3.
|
||||
*/
|
||||
static inline uint32_t touch_ll_sample_cfg_get_engaged_num(void)
|
||||
{
|
||||
uint32_t sample_cfg_num = LP_ANA_PERI.touch_scan_ctrl2.freq_scan_cnt_limit;
|
||||
return sample_cfg_num ? sample_cfg_num : 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set capacitance and resistance of the RC filter of the sampling frequency.
|
||||
*
|
||||
|
@@ -1682,6 +1682,29 @@ static inline void touch_ll_sleep_read_data(uint32_t *raw_data)
|
||||
*raw_data = SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data of the touch channel according to the types
|
||||
*
|
||||
* @param sample_cfg_id The sample configuration index
|
||||
* @param type data type
|
||||
* 0/1: TOUCH_LL_READ_RAW, the raw data of the touch channel
|
||||
* 2: TOUCH_LL_READ_BENCHMARK, benchmark value of touch channel,
|
||||
* the benchmark value is the maximum during the first measurement period
|
||||
* 3: TOUCH_LL_READ_SMOOTH, the smoothed data that obtained by filtering the raw data.
|
||||
* @param smooth_data pointer to smoothed data
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void touch_ll_sleep_read_chan_data(uint8_t type, uint32_t *data)
|
||||
{
|
||||
SENS.sar_touch_conf.touch_data_sel = type;
|
||||
if (type == TOUCH_LL_READ_RAW) {
|
||||
uint32_t touch_num = RTCCNTL.touch_slp_thres.touch_slp_pad;
|
||||
*data = SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||
} else {
|
||||
*data = SENS.sar_touch_slp_status.touch_slp_data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select touch sensor dbias to save power in sleep mode.
|
||||
*
|
||||
|
@@ -1718,6 +1718,29 @@ static inline void touch_ll_sleep_read_data(uint32_t *raw_data)
|
||||
*raw_data = SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data of the touch channel according to the types
|
||||
*
|
||||
* @param sample_cfg_id The sample configuration index
|
||||
* @param type data type
|
||||
* 0/1: TOUCH_LL_READ_RAW, the raw data of the touch channel
|
||||
* 2: TOUCH_LL_READ_BENCHMARK, benchmark value of touch channel,
|
||||
* the benchmark value is the maximum during the first measurement period
|
||||
* 3: TOUCH_LL_READ_SMOOTH, the smoothed data that obtained by filtering the raw data.
|
||||
* @param smooth_data pointer to smoothed data
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void touch_ll_sleep_read_chan_data(uint8_t type, uint32_t *data)
|
||||
{
|
||||
SENS.sar_touch_conf.touch_data_sel = type;
|
||||
if (type == TOUCH_LL_READ_RAW) {
|
||||
uint32_t touch_num = RTCCNTL.touch_slp_thres.touch_slp_pad;
|
||||
*data = SENS.sar_touch_status[touch_num - 1].touch_pad_data;
|
||||
} else {
|
||||
*data = SENS.sar_touch_slp_status.touch_slp_data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Select touch sensor dbias to save power in sleep mode.
|
||||
|
Reference in New Issue
Block a user