Chapter 2. API Reference
Note The threshold compared with touch readings.
Note In order to avoid abnormal short circuit of some touch channels. This function should be turned on.
Ensure the normal operation of other touch channels.
Return
• ESP_OK Success
Parameters
• enable: true(default): Enable the timeout check; false: Disable the timeout check.
• threshold: For all channels, the maximum value that will not be exceeded during normal oper-
ation.
esp_err_t touch_pad_timeout_resume(void)
Call this interface after timeout to make the touch channel resume normal work. Point on the next channel to
measure. If this API is not called, the touch FSM will stop the measurement after timeout interrupt.
Note Call this API after finishes the exception handling by user.
Return
• ESP_OK Success
esp_err_t touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data)
get raw data of touch sensor.
Note After the initialization is complete, the “raw_data”is max value. You need to wait for a measurement
cycle before you can read the correct touch value.
Return
• ESP_OK Success
• ESP_FAIL Touch channel 0 haven’t this parameter.
Parameters
• touch_num: touch pad index
• raw_data: pointer to accept touch sensor value
esp_err_t touch_pad_read_benchmark(touch_pad_t touch_num, uint32_t *benchmark)
get benchmark of touch sensor.
Note After initialization, the benchmark value is the maximum during the first measurement period.
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG Touch channel 0 haven’t this parameter.
Parameters
• touch_num: touch pad index
• benchmark: pointer to accept touch sensor benchmark value
esp_err_t touch_pad_filter_read_smooth(touch_pad_t touch_num, uint32_t *smooth)
Get smoothed data that obtained by filtering the raw data.
Parameters
• touch_num: touch pad index
• smooth: pointer to smoothed data
esp_err_t touch_pad_reset_benchmark(touch_pad_t touch_num)
Force reset benchmark to raw data of touch sensor.
Return
• ESP_OK Success
Parameters
• touch_num: touch pad index
– TOUCH_PAD_MAX Reset basaline of all channels
esp_err_t touch_pad_filter_set_config(const touch_filter_config_t *filter_info)
set parameter of touch sensor filter and detection algorithm. For more details on the detection algorithm, please
refer to the application documentation.
Return
• ESP_OK Success
Parameters
Espressif Systems 403
Submit Document Feedback
Release v4.4