39#define TASK(task_name, task_stack_size) \
41 static void _s_task_impl_##task_name(void *); \
42 static StackType_t _s_stack_##task_name[task_stack_size]; \
44 Task *task_name = &((Task){ \
45 .task_func = _s_task_impl_##task_name, .name = #task_name, .stack = _s_stack_##task_name, .stack_size = task_stack_size, .handle = NULL, \
47 static void _s_task_impl_##task_name(void *context)
52#define MAX_NUM_TASKS 15
57#define TASK_PRIORITY(prio) ((TaskPriority)prio)
63#define WAIT_TASK_TIMEOUT_MS 1000
69#define TASK_MIN_STACK_SIZE configMINIMAL_STACK_SIZE
75#define TASK_STACK_256 ((size_t)256)
76#define TASK_STACK_512 ((size_t)512)
77#define TASK_STACK_1024 ((size_t)1024)
78#define TASK_STACK_2048 ((size_t)2048)
79#define TASK_STACK_4096 ((size_t)4096)
81typedef UBaseType_t TaskPriority;
85 TaskFunction_t task_func;
void tasks_start(void)
Start the FreeRTOS scheduler to run the tasks that were previously initialized.
Definition: tasks.c:73
StatusCode wait_tasks(uint16_t num_tasks)
Waits for num_tasks of RTOS tasks to finish.
Definition: tasks.c:93
StatusCode tasks_init_task(Task *task, TaskPriority priority, void *context)
Initialize a task that was previously declared with TASK().
Definition: tasks.c:40
StatusCode send_task_end(void)
A wrapper to give to the semaphore, to be called by tasks when they complete.
Definition: tasks.c:103
StatusCode tasks_init(void)
Initialize the task module.
Definition: tasks.c:82
StatusCode
StatusCodes for various errors.
Definition: status.h:27