Firmware  0.4.1
Loading...
Searching...
No Matches
task.hpp File Reference

Task macros. More...

#include <esp_task.h>
#include <array>
Include dependency graph for task.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#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.
 

Detailed Description

Author
Vincent Hamp
Date
06/06/2025

Macro Definition Documentation

◆ 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); \
handle = NULL; \
} \
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
NAMEDescriptive name
PRIORITYPriority
CORE_IDCore the task is pinned to
TIMEOUTTimeout in ms

◆ CONCAT

#define CONCAT ( A,
B )
Value:
#define CONCAT_DETAIL(A, B)
Definition task.hpp:27

◆ CONCAT_DETAIL

#define CONCAT_DETAIL ( A,
B )
Value:
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
OBJECTInstance name
NAMEDescriptive name
PRIORITYPriority
CORE_IDCore the task is pinned to
TIMEOUTTimeout 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
OBJECTInstance name
NAMEDescriptive name
STACK_SIZEStack size in bytes
PRIORITYPriority
CORE_IDCore the task is pinned to
TIMEOUTTimeout in ms