Chapter 2. API Reference
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if argument is wrong
Parameters
• mode: FSM mode
esp_err_t touch_pad_get_fsm_mode(touch_fsm_mode_t *mode)
Get touch sensor FSM mode.
Return
• ESP_OK on success
Parameters
• mode: pointer to accept FSM mode
esp_err_t touch_pad_clear_status(void)
To clear the touch sensor channel active status.
Note The FSM automatically updates the touch sensor status. It is generally not necessary to call this API to
clear the status.
Return
• ESP_OK on success
uint32_t touch_pad_get_status(void)
Get the touch sensor channel active status mask. The bit position represents the channel number. The 0/1
status of the bit represents the trigger status.
Return
• The touch sensor status. e.g. Touch1 trigger status is status_mask & (BIT1).
bool touch_pad_meas_is_done(void)
Check touch sensor measurement status.
Return
• True measurement is under way
• False measurement done
GPIO Lookup Macros Some useful macros can be used to specified the GPIO number of a touch pad channel,
or vice versa. e.g.
1. TOUCH_PAD_NUM5_GPIO_NUM is the GPIO number of channel 5 (12);
2. TOUCH_PAD_GPIO4_CHANNEL is the channel number of GPIO 4 (channel 0).
Header File
• components/soc/esp32s2/include/soc/touch_sensor_channel.h
Macros
TOUCH_PAD_GPIO1_CHANNEL
TOUCH_PAD_NUM1_GPIO_NUM
TOUCH_PAD_GPIO2_CHANNEL
TOUCH_PAD_NUM2_GPIO_NUM
TOUCH_PAD_GPIO3_CHANNEL
TOUCH_PAD_NUM3_GPIO_NUM
TOUCH_PAD_GPIO4_CHANNEL
TOUCH_PAD_NUM4_GPIO_NUM
TOUCH_PAD_GPIO5_CHANNEL
TOUCH_PAD_NUM5_GPIO_NUM
Espressif Systems 410
Submit Document Feedback
Release v4.4