EasyManua.ls Logo

Espressif ESP32-S2 - Page 444

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
TOUCH_ELEM_DISP_CALLBACK
Callback dispatch.
TOUCH_ELEM_DISP_MAX
API Reference - Touch Button
Header File
components/touch_element/include/touch_element/touch_button.h
Functions
esp_err_t touch_button_install(const touch_button_global_config_t *global_config)
Touch Button initialize.
This function initializes touch button global and acts on all touch button instances.
Return
ESP_OK: Successfully initialized touch button
ESP_ERR_INVALID_STATE: Touch element library was not initialized
ESP_ERR_INVALID_ARG: button_init is NULL
ESP_ERR_NO_MEM: Insufficient memory
Parameters
[in] global_config: Button object initialization configuration
void touch_button_uninstall(void)
Release resources allocated using touch_button_install()
esp_err_t touch_button_create(const touch_button_config_t *button_config,
touch_button_handle_t *button_handle)
Create a new touch button instance.
Note The sensitivity has to be explored in experiments, Sensitivity = (Raw(touch) - Raw(release)) /
Raw(release) * 100%
Return
ESP_OK: Successfully create touch button
ESP_ERR_INVALID_STATE: Touch button driver was not initialized
ESP_ERR_NO_MEM: Insufficient memory
ESP_ERR_INVALID_ARG: Invalid configuration struct or arguments is NULL
Parameters
[in] button_config: Button configuration
[out] button_handle: Button handle
esp_err_t touch_button_delete(touch_button_handle_t button_handle)
Release resources allocated using touch_button_create()
Return
ESP_OK: Successfully released resources
ESP_ERR_INVALID_STATE: Touch button driver was not initialized
ESP_ERR_INVALID_ARG: button_handle is null
ESP_ERR_NOT_FOUND: Input handle is not a button handle
Parameters
[in] button_handle: Button handle
esp_err_t touch_button_subscribe_event(touch_button_handle_t button_handle, uint32_t
event_mask, void *arg)
Touch button subscribes event.
This function uses event mask to subscribe to touch button events, once one of the subscribed events occurs,
the event message could be retrieved by calling touch_element_message_receive() or input callback routine.
Note Touch button only support three kind of event masks, they are TOUCH_ELEM_EVENT_ON_PRESS,
TOUCH_ELEM_EVENT_ON_RELEASE, TOUCH_ELEM_EVENT_ON_LONGPRESS. You can
use those event masks in any combination to achieve the desired effect.
Espressif Systems 433
Submit Document Feedback
Release v4.4

Table of Contents