Event Handling; Wi-Fi, Ethernet, And Ip Events - Espressif ESP32-S2 Programming Manual

Table of Contents

Advertisement

Chapter 4. API Guides
–core-format {b64,elf,raw}, -t {b64,elf,raw} File specified with "-c"is an ELF ("elf"), raw
(raw) or base64-encoded (b64) binary
--off OFF, -o OFF
--save-core SAVE_CORE, -s SAVE_CORE Save core to file. Otherwise tem-
--rom-elf ROM_ELF, -r ROM_ELF Path to ROM ELF file. Will use "<tar-
--print-mem, -m
<prog> Path to program ELF file.

4.10 Event Handling

Several ESP-IDF components use events to inform application about state changes, such as connection or disconnec-
tion. This document gives an overview of these event mechanisms.

4.10.1 Wi-Fi, Ethernet, and IP Events

Before the introduction of
dispatched using the so-called legacy event loop. The following sections explain each of the methods.
esp_event Library Event Loop
esp_event library is designed to supersede the legacy event loop for the purposes of event handling in ESP-IDF. In
the legacy event loop, all possible event types and event data structures had to be defined in
enumeration and
system_event_info_t
loop, and use the event loop for other kinds of events (e.g. Mesh). Legacy event loop also supported only one event
handler function, therefore application components could not handle some of Wi-Fi or IP events themselves, and
required application to forward these events from its event handler function.
See
esp_event library API reference
sent to the
default event loop
Legacy Event Loop
This event loop implementation is started using
plies an event handler, a function with the following signature:
esp_err_t event_handler(void *ctx, system_event_t *event)
{
}
Both the pointer to event handler function,
esp_event_loop_init().
When Wi-Fi, Ethernet, or IP stack generate an event, this event is sent to a high-priority event task via
a queue. Application-provided event handler function is called in the context of this task. Event task stack
size and event queue size can be adjusted using
FIG_ESP_SYSTEM_EVENT_QUEUE_SIZE
Event handler receives a pointer to the event structure (system_event_t) which describes current event. This
structure follows a tagged union pattern: event_id member indicates the type of event, and event_info member
is a union of description structures. Application event handler will typically use switch(event->event_id)
to handle different kinds of events.
Espressif Systems
Offset of coredump partition in flash (type "make parti-
tion_table"to see).
porary core file will be deleted. Does not work with "-c"
get>_rom.elf"if not specified
Print memory dump. Only valid when info_corefile.
esp_event
library, events from Wi-Fi driver, Ethernet driver, and TCP/IP stack were
union, which made it impossible to send custom events to the event
for general information on using this library. Wi-Fi, Ethernet, and IP events are
provided by this library.
esp_event_loop_init()
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE
options, respectively.
Submit Document Feedback
function. Application typically sup-
and an arbitrary context pointer are passed to
1330
system_event_id_t
and
CON-
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Table of Contents

Save PDF