EasyManua.ls Logo

Espressif ESP32-S2 - Page 445

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
Return
ESP_OK: Successfully subscribed touch button event
ESP_ERR_INVALID_STATE: Touch button driver was not initialized
ESP_ERR_INVALID_ARG: button_handle is null or event is not supported
Parameters
[in] button_handle: Button handle
[in] event_mask: Button subscription event mask
[in] arg: User input argument
esp_err_t touch_button_set_dispatch_method(touch_button_handle_t button_handle,
touch_elem_dispatch_t dispatch_method)
Touch button set dispatch method.
This function sets a dispatch method that the driver core will use this method as the event notification method.
Return
ESP_OK: Successfully set dispatch method
ESP_ERR_INVALID_STATE: Touch button driver was not initialized
ESP_ERR_INVALID_ARG: button_handle is null or dispatch_method is invalid
Parameters
[in] button_handle: Button handle
[in] dispatch_method: Dispatch method (By callback/event)
esp_err_t touch_button_set_callback(touch_button_handle_t button_handle,
touch_button_callback_t button_callback)
Touch button set callback.
This function sets a callback routine into touch element driver core, when the subscribed events occur, the
callback routine will be called.
Note Button message will be passed from the callback function and it will be destroyed when the callback
function return.
Warning Since this input callback routine runs on driver core (esp-timer callback routine), it should not do
something that attempts to Block, such as calling vTaskDelay().
Return
ESP_OK: Successfully set callback
ESP_ERR_INVALID_STATE: Touch button driver was not initialized
ESP_ERR_INVALID_ARG: button_handle or button_callback is null
Parameters
[in] button_handle: Button handle
[in] button_callback: User input callback
esp_err_t touch_button_set_longpress(touch_button_handle_t button_handle, uint32_t thresh-
old_time)
Touch button set long press trigger time.
This function sets the threshold time (ms) for a long press event. If a button is pressed and held for a period of
time that exceeds the threshold time, a long press event is triggered.
Return
ESP_OK: Successfully set the threshold time of long press event
ESP_ERR_INVALID_STATE: Touch button driver was not initialized
ESP_ERR_INVALID_ARG: button_handle is null or time (ms) is not lager than 0
Parameters
[in] button_handle: Button handle
[in] threshold_time: Threshold time (ms) of long press event occur
const touch_button_message_t *touch_button_get_message(const touch_elem_message_t
*element_message)
Touch button get message.
This function decodes the element message from touch_element_message_receive() and return a button mes-
sage pointer.
Return Touch button message pointer
Espressif Systems 434
Submit Document Feedback
Release v4.4

Table of Contents