|
esp_iot_framework
v0.1.0-alpha
© 2026 AmakeSasha, distributed under a license Apache-2.0
|
Miscellaneous helper macros. More...
Macros | |
| #define | EIF_TASK_LAUNCH(m_ret, m_handle, m_alias, m_worker) |
| Spawns a system task using standardized, auto-resolved configuration macros. More... | |
This group serves as a collection point for utility macros that currently do not belong to any specific category. It includes tools that are either unique in their purpose or haven't yet reached a sufficient "critical mass" to justify the creation of a dedicated group.
| #define EIF_TASK_LAUNCH | ( | m_ret, | |
| m_handle, | |||
| m_alias, | |||
| m_worker | |||
| ) |
This macro simplifies task creation by enforcing a unified naming convention for task parameters. By providing a base alias (m_alias), the macro automatically constructs the necessary configuration definitions (Name, Stack Size, Priority) using the ## token pasting operator.
For this macro to compile, you must define the corresponding parameters before calling it. For an alias X, the following definitions must exist:
TASK_X_NAME (String literal, task name in the scheduler)TASK_X_SIZE (Integer, stack size in words (4 byte))TASK_X_PRIORITY (Integer, FreeRTOS priority)m_handle argument must point to a persistent variable (typically a module-scoped static) to maintain double-spawn protection. Once the task finishes execution or triggers a delete, the underlying task handle variable must be set back to NULL to allow future respawns.| [out] | m_ret | Status variable (esp_err_t) to store the creation result. |
| [in,out] | m_handle | Variable of type TaskHandle_t to store the spawned task handle. |
| [in] | m_alias | The base identifier alias (e.g., WIFI, SENSOR, MQTT). |
| [in] | m_worker | The function pointer to the task entry point (worker function). |
Example of use:
Example of use (without double-call protection):