Task macros.
More...
#include <esp_task.h>
#include <array>
Go to the source code of this file.
|
#define | CONCAT_DETAIL(A, B) |
|
#define | CONCAT(A, B) |
|
#define | COMMON_TASK_MEMBERS(NAME, PRIORITY, CORE_ID, TIMEOUT) |
| Members common for TASK and SHARED_TASK.
|
|
#define | TASK(OBJECT, NAME, STACK_SIZE, PRIORITY, CORE_ID, TIMEOUT) |
| Create task.
|
|
#define | SHARED_TASK(OBJECT, NAME, PRIORITY, CORE_ID, TIMEOUT) |
| Create shared task.
|
|
- Author
- Vincent Hamp
- Date
- 06/06/2025
◆ COMMON_TASK_MEMBERS
#define COMMON_TASK_MEMBERS |
( |
| NAME, |
|
|
| PRIORITY, |
|
|
| CORE_ID, |
|
|
| TIMEOUT ) |
Value: static constexpr char const* name{NAME}; \
static constexpr UBaseType_t priority{PRIORITY}; \
static constexpr BaseType_t core_id{CORE_ID}; \
static constexpr TickType_t timeout{TIMEOUT}; \
static inline StaticTask_t tcb{}; \
static inline TaskFunction_t function{NULL}; \
static inline TaskHandle_t
handle{NULL}; \
static void create(TaskFunction_t f = function) { \
handle = xTaskCreateStaticPinnedToCore(function = f, \
name, \
size(stack), \
NULL, \
priority, \
data(stack), \
&tcb, \
core_id); \
} \
static void destroy() { \
vTaskDelete(handle); \
} \
static void resume() { vTaskResume(handle); } \
static void suspend() { vTaskSuspend(handle); }
esp_err_t suspend()
Definition suspend.cpp:57
esp_err_t resume()
Definition resume.cpp:43
httpd_handle_t handle
Handle to server instance.
Definition config.hpp:445
- Parameters
-
NAME | Descriptive name |
PRIORITY | Priority |
CORE_ID | Core the task is pinned to |
TIMEOUT | Timeout in ms |
◆ CONCAT
Value:
#define CONCAT_DETAIL(A, B)
Definition task.hpp:27
◆ CONCAT_DETAIL
#define CONCAT_DETAIL |
( |
| A, |
|
|
| B ) |
◆ SHARED_TASK
#define SHARED_TASK |
( |
| OBJECT, |
|
|
| NAME, |
|
|
| PRIORITY, |
|
|
| CORE_ID, |
|
|
| TIMEOUT ) |
Value: struct CONCAT(SharedTask, __LINE__) { \
COMMON_TASK_MEMBERS(NAME, PRIORITY, CORE_ID, TIMEOUT) \
} OBJECT
#define CONCAT(A, B)
Definition task.hpp:28
- Parameters
-
OBJECT | Instance name |
NAME | Descriptive name |
PRIORITY | Priority |
CORE_ID | Core the task is pinned to |
TIMEOUT | Timeout in ms |
◆ TASK
#define TASK |
( |
| OBJECT, |
|
|
| NAME, |
|
|
| STACK_SIZE, |
|
|
| PRIORITY, |
|
|
| CORE_ID, |
|
|
| TIMEOUT ) |
Value: struct CONCAT(Task, __LINE__) { \
static inline std::array<StackType_t, STACK_SIZE> stack{}; \
COMMON_TASK_MEMBERS(NAME, PRIORITY, CORE_ID, TIMEOUT) \
} OBJECT
- Parameters
-
OBJECT | Instance name |
NAME | Descriptive name |
STACK_SIZE | Stack size in bytes |
PRIORITY | Priority |
CORE_ID | Core the task is pinned to |
TIMEOUT | Timeout in ms |