EasyManuals Logo

Espressif ESP32-S2 User Manual

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
Page #852 background imageLoading...
Page #852 background image
Chapter 2. API Reference
[in] event_handler_arg: data, aside from event data, that is passed to the handler when it
is called
[out] instance: An event handler instance object related to the registered event handler and
data, can be NULL. This needs to be kept if the specific callback instance should be unregistered
before deleting the whole event loop. Registering the same event handler multiple times is possible
and yields distinct instance objects. The data can be the same for all registrations. If no unregistration
is needed but the handler should be deleted when the event loop is deleted, instance can be NULL.
esp_err_t esp_event_handler_instance_register(esp_event_base_t event_base, int32_t
event_id, esp_event_handler_t
event_handler, void *event_handler_arg,
esp_event_handler_instance_t *instance)
Register an instance of event handler to the default loop.
This function does the same as esp_event_handler_instance_register_with, except that it registers the handler
to the default event loop.
Note the event loop library does not maintain a copy of event_handler_arg, therefore the user should ensure
that event_handler_arg still points to a valid location by the time the handler gets called
Return
ESP_OK: Success
ESP_ERR_NO_MEM: Cannot allocate memory for the handler
ESP_ERR_INVALID_ARG: Invalid combination of event base and event id or instance is NULL
Others: Fail
Parameters
[in] event_base: the base id of the event to register the handler for
[in] event_id: the id of the event to register the handler for
[in] event_handler: the handler function which gets called when the event is dispatched
[in] event_handler_arg: data, aside from event data, that is passed to the handler when it
is called
[out] instance: An event handler instance object related to the registered event handler and
data, can be NULL. This needs to be kept if the specific callback instance should be unregistered
before deleting the whole event loop. Registering the same event handler multiple times is possible
and yields distinct instance objects. The data can be the same for all registrations. If no unregistration
is needed but the handler should be deleted when the event loop is deleted, instance can be NULL.
esp_err_t esp_event_handler_unregister(esp_event_base_t event_base, int32_t event_id,
esp_event_handler_t event_handler)
Unregister a handler with the system event loop (legacy).
Unregisters a handler so it will no longer be called during dispatch. Handlers can be unregistered for any com-
bination of event_base and event_id which were previously registered. To unregister a handler, the event_base
and event_id arguments must match exactly the arguments passed to esp_event_handler_register() when that
handler was registered. Passing ESP_EVENT_ANY_BASE and/or ESP_EVENT_ANY_ID will only unreg-
ister handlers that were registered with the same wildcard arguments.
Note This function is obsolete and will be deprecated soon, please use
esp_event_handler_instance_unregister() instead.
Note When using ESP_EVENT_ANY_ID, handlers registered to specific event IDs using the same base will
not be unregistered. When using ESP_EVENT_ANY_BASE, events registered to specific bases will
also not be unregistered. This avoids accidental unregistration of handlers registered by other users or
components.
Return ESP_OK success
Return ESP_ERR_INVALID_ARG invalid combination of event base and event id
Return others fail
Parameters
[in] event_base: the base of the event with which to unregister the handler
[in] event_id: the id of the event with which to unregister the handler
[in] event_handler: the handler to unregister
Espressif Systems 841
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish