mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
touch_sensor: apply general check
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "driver/rtc_cntl.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_check.h"
|
||||
|
||||
#include "hal/touch_sensor_types.h"
|
||||
#include "hal/touch_sensor_hal.h"
|
||||
@@ -36,18 +37,14 @@
|
||||
#define TOUCH_PAD_MEASURE_WAIT_DEFAULT (0xFF) // The timer frequency is 8Mhz, the max value is 0xff
|
||||
|
||||
static const char *TOUCH_TAG = "TOUCH_SENSOR";
|
||||
#define TOUCH_CHECK(a, str, ret_val) ({ \
|
||||
if (!(a)) { \
|
||||
ESP_LOGE(TOUCH_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \
|
||||
return (ret_val); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define TOUCH_CHANNEL_CHECK(channel) do { \
|
||||
TOUCH_CHECK(channel < SOC_TOUCH_SENSOR_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); \
|
||||
ESP_RETURN_ON_FALSE(channel < SOC_TOUCH_SENSOR_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"); \
|
||||
} while (0);
|
||||
#define TOUCH_CH_MASK_CHECK(mask) TOUCH_CHECK((mask <= TOUCH_PAD_BIT_MASK_ALL), "touch channel bitmask error", ESP_ERR_INVALID_ARG)
|
||||
#define TOUCH_INTR_MASK_CHECK(mask) TOUCH_CHECK(mask & TOUCH_PAD_INTR_MASK_ALL, "intr mask error", ESP_ERR_INVALID_ARG)
|
||||
#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");
|
||||
#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_PARAM_CHECK_STR(s) ""s" parameter error"
|
||||
|
||||
extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished.
|
||||
@@ -85,7 +82,7 @@ static void touch_pad_workaround_isr_internal(void *arg)
|
||||
esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg, touch_pad_intr_mask_t intr_mask)
|
||||
{
|
||||
static bool reg_flag = false;
|
||||
TOUCH_CHECK(fn != NULL, TOUCH_PARAM_CHECK_STR("intr_mask"), ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(fn, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("intr_mask"));
|
||||
TOUCH_INTR_MASK_CHECK(intr_mask);
|
||||
|
||||
uint32_t en_msk = 0;
|
||||
@@ -141,7 +138,7 @@ esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_times)
|
||||
|
||||
esp_err_t touch_pad_set_idle_channel_connect(touch_pad_conn_type_t type)
|
||||
{
|
||||
TOUCH_CHECK(type < TOUCH_PAD_CONN_MAX, TOUCH_PARAM_CHECK_STR("type"), ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(type < TOUCH_PAD_CONN_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("type"));
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_set_idle_channel_connect(type);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -150,6 +147,7 @@ esp_err_t touch_pad_set_idle_channel_connect(touch_pad_conn_type_t type)
|
||||
|
||||
esp_err_t touch_pad_get_idle_channel_connect(touch_pad_conn_type_t *type)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(type, "type");
|
||||
touch_hal_get_idle_channel_connect(type);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -171,6 +169,7 @@ esp_err_t touch_pad_set_channel_mask(uint16_t enable_mask)
|
||||
|
||||
esp_err_t touch_pad_get_channel_mask(uint16_t *enable_mask)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(enable_mask, "enable_mask");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_get_channel_mask(enable_mask);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -243,6 +242,7 @@ esp_err_t touch_pad_timeout_set(bool enable, uint32_t threshold)
|
||||
|
||||
esp_err_t touch_pad_timeout_get_threshold(uint32_t *threshold)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(threshold, "threshold");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_timeout_get_threshold(threshold);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -286,7 +286,7 @@ esp_err_t touch_pad_init(void)
|
||||
|
||||
esp_err_t touch_pad_deinit(void)
|
||||
{
|
||||
TOUCH_CHECK(rtc_touch_mux != NULL, "Touch pad not initialized", ESP_FAIL);
|
||||
ESP_RETURN_ON_FALSE(rtc_touch_mux, ESP_FAIL, TOUCH_TAG, "Touch pad not initialized");
|
||||
xSemaphoreTake(rtc_touch_mux, portMAX_DELAY);
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_deinit();
|
||||
@@ -307,7 +307,8 @@ esp_err_t touch_pad_reset(void)
|
||||
|
||||
esp_err_t IRAM_ATTR touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data)
|
||||
{
|
||||
TOUCH_CHECK(touch_num < TOUCH_PAD_MAX && touch_num >= 0, "Touch channel error", ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(touch_num < TOUCH_PAD_MAX && touch_num >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error");
|
||||
TOUCH_NULL_POINTER_CHECK(raw_data, "raw_data");
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
*raw_data = touch_hal_read_raw_data(touch_num);
|
||||
TOUCH_EXIT_CRITICAL_SAFE();
|
||||
@@ -316,6 +317,7 @@ esp_err_t IRAM_ATTR touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw
|
||||
|
||||
esp_err_t IRAM_ATTR touch_pad_filter_read_smooth(touch_pad_t touch_num, uint32_t *smooth_data)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(smooth_data, "smooth_data");
|
||||
TOUCH_CHANNEL_CHECK(touch_num);
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_filter_read_smooth(touch_num, smooth_data);
|
||||
@@ -325,6 +327,7 @@ esp_err_t IRAM_ATTR touch_pad_filter_read_smooth(touch_pad_t touch_num, uint32_t
|
||||
|
||||
esp_err_t IRAM_ATTR touch_pad_read_benchmark(touch_pad_t touch_num, uint32_t *benchmark)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(benchmark, "benchmark");
|
||||
TOUCH_CHANNEL_CHECK(touch_num);
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_read_benchmark(touch_num, benchmark);
|
||||
@@ -335,20 +338,21 @@ esp_err_t IRAM_ATTR touch_pad_read_benchmark(touch_pad_t touch_num, uint32_t *be
|
||||
/* Should be call after clk enable and filter enable. */
|
||||
esp_err_t touch_pad_reset_benchmark(touch_pad_t touch_num)
|
||||
{
|
||||
TOUCH_CHECK(touch_num <= TOUCH_PAD_MAX && touch_num >= 0, "Touch channel error", ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(touch_num <= TOUCH_PAD_MAX && touch_num >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_reset_benchmark(touch_num);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t touch_pad_filter_set_config(touch_filter_config_t *filter_info)
|
||||
esp_err_t touch_pad_filter_set_config(const touch_filter_config_t *filter_info)
|
||||
{
|
||||
TOUCH_CHECK(filter_info->mode < TOUCH_PAD_FILTER_MAX, TOUCH_PARAM_CHECK_STR("mode"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_CHECK(filter_info->debounce_cnt <= TOUCH_DEBOUNCE_CNT_MAX, TOUCH_PARAM_CHECK_STR("debounce"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_CHECK(filter_info->noise_thr <= TOUCH_NOISE_THR_MAX, TOUCH_PARAM_CHECK_STR("noise"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_CHECK(filter_info->jitter_step <= TOUCH_JITTER_STEP_MAX, TOUCH_PARAM_CHECK_STR("jitter_step"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_CHECK(filter_info->smh_lvl < TOUCH_PAD_SMOOTH_MAX, TOUCH_PARAM_CHECK_STR("smooth level"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_NULL_POINTER_CHECK(filter_info, "filter_info");
|
||||
ESP_RETURN_ON_FALSE(filter_info->mode < TOUCH_PAD_FILTER_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("mode"));
|
||||
ESP_RETURN_ON_FALSE(filter_info->debounce_cnt <= TOUCH_DEBOUNCE_CNT_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("debounce"));
|
||||
ESP_RETURN_ON_FALSE(filter_info->noise_thr <= TOUCH_NOISE_THR_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("noise"));
|
||||
ESP_RETURN_ON_FALSE(filter_info->jitter_step <= TOUCH_JITTER_STEP_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("jitter_step"));
|
||||
ESP_RETURN_ON_FALSE(filter_info->smh_lvl < TOUCH_PAD_SMOOTH_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("smooth level"));
|
||||
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_filter_set_config(filter_info);
|
||||
@@ -359,6 +363,7 @@ esp_err_t touch_pad_filter_set_config(touch_filter_config_t *filter_info)
|
||||
|
||||
esp_err_t touch_pad_filter_get_config(touch_filter_config_t *filter_info)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(filter_info, "filter_info");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_filter_get_config(filter_info);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -398,10 +403,11 @@ esp_err_t touch_pad_denoise_disable(void)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t touch_pad_denoise_set_config(touch_pad_denoise_t *denoise)
|
||||
esp_err_t touch_pad_denoise_set_config(const touch_pad_denoise_t *denoise)
|
||||
{
|
||||
TOUCH_CHECK(denoise->grade < TOUCH_PAD_DENOISE_MAX, TOUCH_PARAM_CHECK_STR("grade"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_CHECK(denoise->cap_level < TOUCH_PAD_DENOISE_CAP_MAX, TOUCH_PARAM_CHECK_STR("cap_level"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_NULL_POINTER_CHECK(denoise, "denoise");
|
||||
ESP_RETURN_ON_FALSE(denoise->grade < TOUCH_PAD_DENOISE_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("grade"));
|
||||
ESP_RETURN_ON_FALSE(denoise->cap_level < TOUCH_PAD_DENOISE_CAP_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("cap_level"));
|
||||
|
||||
const touch_hal_meas_mode_t meas = {
|
||||
.slope = TOUCH_PAD_SLOPE_DEFAULT,
|
||||
@@ -417,6 +423,7 @@ esp_err_t touch_pad_denoise_set_config(touch_pad_denoise_t *denoise)
|
||||
|
||||
esp_err_t touch_pad_denoise_get_config(touch_pad_denoise_t *denoise)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(denoise, "denoise");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_denoise_get_config(denoise);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -425,14 +432,16 @@ esp_err_t touch_pad_denoise_get_config(touch_pad_denoise_t *denoise)
|
||||
|
||||
esp_err_t touch_pad_denoise_read_data(uint32_t *data)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(data, "data");
|
||||
touch_hal_denoise_read_data(data);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t touch_pad_waterproof_set_config(touch_pad_waterproof_t *waterproof)
|
||||
esp_err_t touch_pad_waterproof_set_config(const touch_pad_waterproof_t *waterproof)
|
||||
{
|
||||
TOUCH_CHECK(waterproof->guard_ring_pad < SOC_TOUCH_SENSOR_NUM, TOUCH_PARAM_CHECK_STR("pad"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_CHECK(waterproof->shield_driver < TOUCH_PAD_SHIELD_DRV_MAX, TOUCH_PARAM_CHECK_STR("shield_driver"), ESP_ERR_INVALID_ARG);
|
||||
TOUCH_NULL_POINTER_CHECK(waterproof, "waterproof");
|
||||
ESP_RETURN_ON_FALSE(waterproof->guard_ring_pad < SOC_TOUCH_SENSOR_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();
|
||||
touch_hal_waterproof_set_config(waterproof);
|
||||
@@ -442,6 +451,7 @@ esp_err_t touch_pad_waterproof_set_config(touch_pad_waterproof_t *waterproof)
|
||||
|
||||
esp_err_t touch_pad_waterproof_get_config(touch_pad_waterproof_t *waterproof)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(waterproof, "waterproof");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_waterproof_get_config(waterproof);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -468,7 +478,7 @@ esp_err_t touch_pad_waterproof_disable(void)
|
||||
esp_err_t touch_pad_proximity_enable(touch_pad_t touch_num, bool enabled)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
TOUCH_CHECK(touch_num < TOUCH_PAD_MAX, "Touch channel error", ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(touch_num < TOUCH_PAD_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error");
|
||||
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
if (!touch_hal_enable_proximity(touch_num, enabled)) {
|
||||
@@ -480,7 +490,7 @@ esp_err_t touch_pad_proximity_enable(touch_pad_t touch_num, bool enabled)
|
||||
|
||||
esp_err_t touch_pad_proximity_set_count(touch_pad_t touch_num, uint32_t count)
|
||||
{
|
||||
TOUCH_CHECK(count <= TOUCH_PROXIMITY_MEAS_NUM_MAX, TOUCH_PARAM_CHECK_STR("measure count"), ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(count <= TOUCH_PROXIMITY_MEAS_NUM_MAX, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("measure count"));
|
||||
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_proximity_set_meas_times(count);
|
||||
@@ -490,7 +500,7 @@ esp_err_t touch_pad_proximity_set_count(touch_pad_t touch_num, uint32_t count)
|
||||
|
||||
esp_err_t touch_pad_proximity_get_count(touch_pad_t touch_num, uint32_t *count)
|
||||
{
|
||||
TOUCH_CHECK(count != NULL, TOUCH_PARAM_CHECK_STR("measure count"), ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(count, ESP_ERR_INVALID_ARG, TOUCH_TAG, TOUCH_PARAM_CHECK_STR("measure count"));
|
||||
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_proximity_get_meas_times(count);
|
||||
@@ -509,7 +519,8 @@ esp_err_t touch_pad_proximity_get_count(touch_pad_t touch_num, uint32_t *count)
|
||||
*/
|
||||
esp_err_t touch_pad_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt)
|
||||
{
|
||||
TOUCH_CHECK(touch_hal_proximity_pad_check(touch_num), "touch num is not proximity", ESP_ERR_INVALID_ARG);
|
||||
TOUCH_NULL_POINTER_CHECK(cnt, "cnt");
|
||||
ESP_RETURN_ON_FALSE(touch_hal_proximity_pad_check(touch_num), ESP_ERR_INVALID_ARG, TOUCH_TAG, "touch num is not proximity");
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_proximity_read_meas_cnt(touch_num, cnt);
|
||||
TOUCH_EXIT_CRITICAL_SAFE();
|
||||
@@ -518,7 +529,8 @@ esp_err_t touch_pad_proximity_read_meas_cnt(touch_pad_t touch_num, uint32_t *cnt
|
||||
|
||||
esp_err_t touch_pad_proximity_get_data(touch_pad_t touch_num, uint32_t *measure_out)
|
||||
{
|
||||
TOUCH_CHECK(touch_hal_proximity_pad_check(touch_num), "touch num is not proximity", ESP_ERR_INVALID_ARG);
|
||||
ESP_RETURN_ON_FALSE(touch_hal_proximity_pad_check(touch_num), ESP_ERR_INVALID_ARG, TOUCH_TAG, "touch num is not proximity");
|
||||
TOUCH_NULL_POINTER_CHECK(measure_out, "measure_out");
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_read_benchmark(touch_num, measure_out);
|
||||
TOUCH_EXIT_CRITICAL_SAFE();
|
||||
@@ -529,6 +541,7 @@ esp_err_t touch_pad_proximity_get_data(touch_pad_t touch_num, uint32_t *measure_
|
||||
|
||||
esp_err_t touch_pad_sleep_channel_get_info(touch_pad_sleep_channel_t *slp_config)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(slp_config, "slp_config");
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_sleep_channel_get_config(slp_config);
|
||||
TOUCH_EXIT_CRITICAL_SAFE();
|
||||
@@ -561,6 +574,7 @@ esp_err_t touch_pad_sleep_channel_enable_proximity(touch_pad_t pad_num, bool ena
|
||||
|
||||
esp_err_t touch_pad_sleep_get_channel_num(touch_pad_t *pad_num)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(pad_num, "pad_num");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_sleep_get_channel_num(pad_num);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -577,6 +591,7 @@ esp_err_t touch_pad_sleep_set_threshold(touch_pad_t pad_num, uint32_t touch_thre
|
||||
|
||||
esp_err_t touch_pad_sleep_get_threshold(touch_pad_t pad_num, uint32_t *touch_thres)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(touch_thres, "touch_thres");
|
||||
TOUCH_ENTER_CRITICAL();
|
||||
touch_hal_sleep_get_threshold(touch_thres);
|
||||
TOUCH_EXIT_CRITICAL();
|
||||
@@ -585,6 +600,7 @@ esp_err_t touch_pad_sleep_get_threshold(touch_pad_t pad_num, uint32_t *touch_thr
|
||||
|
||||
esp_err_t touch_pad_sleep_channel_read_benchmark(touch_pad_t pad_num, uint32_t *benchmark)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(benchmark, "benchmark");
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_sleep_read_benchmark(benchmark);
|
||||
TOUCH_EXIT_CRITICAL_SAFE();
|
||||
@@ -593,6 +609,7 @@ esp_err_t touch_pad_sleep_channel_read_benchmark(touch_pad_t pad_num, uint32_t *
|
||||
|
||||
esp_err_t touch_pad_sleep_channel_read_smooth(touch_pad_t pad_num, uint32_t *smooth_data)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(smooth_data, "smooth_data");
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_sleep_read_smooth(smooth_data);
|
||||
TOUCH_EXIT_CRITICAL_SAFE();
|
||||
@@ -601,6 +618,7 @@ esp_err_t touch_pad_sleep_channel_read_smooth(touch_pad_t pad_num, uint32_t *smo
|
||||
|
||||
esp_err_t touch_pad_sleep_channel_read_data(touch_pad_t pad_num, uint32_t *raw_data)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(raw_data, "raw_data");
|
||||
TOUCH_ENTER_CRITICAL_SAFE();
|
||||
touch_hal_sleep_read_data(raw_data);
|
||||
TOUCH_EXIT_CRITICAL_SAFE();
|
||||
@@ -617,12 +635,14 @@ esp_err_t touch_pad_sleep_channel_reset_benchmark(void)
|
||||
|
||||
esp_err_t touch_pad_sleep_channel_read_debounce(touch_pad_t pad_num, uint32_t *debounce)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(debounce, "debounce");
|
||||
touch_hal_sleep_read_debounce(debounce);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t touch_pad_sleep_channel_read_proximity_cnt(touch_pad_t pad_num, uint32_t *approach_cnt)
|
||||
{
|
||||
TOUCH_NULL_POINTER_CHECK(approach_cnt, "approach_cnt");
|
||||
touch_hal_sleep_read_proximity_cnt(approach_cnt);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user