Chapter 2. API Reference
Functions
esp_err_t touch_pad_fsm_start(void)
Set touch sensor FSM start.
Note Start FSM after the touch sensor FSM mode is set.
Note Call this function will reset benchmark of all touch channels.
Return
• ESP_OK on success
esp_err_t touch_pad_fsm_stop(void)
Stop touch sensor FSM.
Return
• ESP_OK on success
esp_err_t touch_pad_sw_start(void)
Trigger a touch sensor measurement, only support in SW mode of FSM.
Return
• ESP_OK on success
esp_err_t touch_pad_set_meas_time(uint16_t sleep_cycle, uint16_t meas_times)
Set touch sensor times of charge and discharge and sleep time. Excessive total time will slow down the touch
response. Too small measurement time will not be sampled enough, resulting in inaccurate measurements.
Note The greater the duty cycle of the measurement time, the more system power is consumed.
Return
• ESP_OK on success
Parameters
• sleep_cycle: The touch sensor will sleep after each measurement. sleep_cycle decide the in-
terval between each measurement. t_sleep = sleep_cycle / (RTC_SLOW_CLK frequency). The ap-
proximate frequency value of RTC_SLOW_CLK can be obtained using rtc_clk_slow_freq_get_hz
function.
• meas_times: The times of charge and discharge in each measure process of touch channels. The
timer frequency is 8Mhz. Range: 0 ~ 0xffff. Recommended typical value: Modify this value to
make the measurement time around 1ms.
esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_times)
Get touch sensor times of charge and discharge and sleep time.
Return
• ESP_OK on success
Parameters
• sleep_cycle: Pointer to accept sleep cycle number
• meas_times: Pointer to accept measurement times count.
esp_err_t touch_pad_set_idle_channel_connect(touch_pad_conn_type_t type)
Set connection type of touch channel in idle status. When a channel is in measurement mode, other initialized
channels are in idle mode. The touch channel is generally adjacent to the trace, so the connection state of the
idle channel affects the stability and sensitivity of the test channel. The CONN_HIGHZ(high resistance) setting
increases the sensitivity of touch channels. The CONN_GND(grounding) setting increases the stability of touch
channels.
Return
• ESP_OK on success
Parameters
• type: Select idle channel connect to high resistance state or ground.
esp_err_t touch_pad_get_idle_channel_connect(touch_pad_conn_type_t *type)
Set connection type of touch channel in idle status. When a channel is in measurement mode, other initialized
channels are in idle mode. The touch channel is generally adjacent to the trace, so the connection state of the
idle channel affects the stability and sensitivity of the test channel. The CONN_HIGHZ(high resistance) setting
increases the sensitivity of touch channels. The CONN_GND(grounding) setting increases the stability of touch
channels.
Espressif Systems 400
Submit Document Feedback
Release v4.4