Chapter 2. API Reference
Return
• ESP_OK on success
Parameters
• type: Pointer to connection type.
esp_err_t touch_pad_set_thresh(touch_pad_t touch_num, uint32_t threshold)
Set the trigger threshold of touch sensor. 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.
Return
• ESP_OK on success
Parameters
• touch_num: touch pad index
• threshold: threshold of touch sensor. Should be less than the max change value of touch.
esp_err_t touch_pad_get_thresh(touch_pad_t touch_num, uint32_t *threshold)
Get touch sensor trigger threshold.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if argument is wrong
Parameters
• touch_num: touch pad index
• threshold: pointer to accept threshold
esp_err_t touch_pad_set_channel_mask(uint16_t enable_mask)
Register touch channel into touch sensor scan group. The working mode of the touch sensor is cyclically
scanned. This function will set the scan bits according to the given bitmask.
Note If set this mask, the FSM timer should be stop firsty.
Note The touch sensor that in scan map, should be deinit GPIO function firstly by touch_pad_io_init.
Return
• ESP_OK on success
Parameters
• enable_mask: bitmask of touch sensor scan group. e.g. TOUCH_PAD_NUM14 -> BIT(14)
esp_err_t touch_pad_get_channel_mask(uint16_t *enable_mask)
Get the touch sensor scan group bit mask.
Return
• ESP_OK on success
Parameters
• enable_mask: Pointer to bitmask of touch sensor scan group. e.g. TOUCH_PAD_NUM14 ->
BIT(14)
esp_err_t touch_pad_clear_channel_mask(uint16_t enable_mask)
Clear touch channel from touch sensor scan group. The working mode of the touch sensor is cyclically scanned.
This function will clear the scan bits according to the given bitmask.
Note If clear all mask, the FSM timer should be stop firsty.
Return
• ESP_OK on success
Parameters
• enable_mask: bitmask of touch sensor scan group. e.g. TOUCH_PAD_NUM14 -> BIT(14)
esp_err_t touch_pad_config(touch_pad_t touch_num)
Configure parameter for each touch channel.
Note Touch num 0 is denoise channel, please use touch_pad_denoise_enable to set denoise function
Return
• ESP_OK Success
• ESP_ERR_INVALID_ARG if argument wrong
• ESP_FAIL if touch pad not initialized
Espressif Systems 401
Submit Document Feedback
Release v4.4