4#include "freertos/FreeRTOS.h"
5#include "freertos/task.h"
6#elif defined(__linux__)
26 TaskRTOS(
const char* name,
int stackSize,
int priority = 1,
int core = -1) {
27 create(name, stackSize, priority, core);
31 create(
"TaskRTOS", 4096, 1, -1);
45 bool begin(std::function<
void()> process) {
58 "TaskRTOS::suspend() called but task not created");
67 "TaskRTOS::resume() called but task not created");
81 int getCoreID() {
return xPortGetCoreID(); }
90 bool create(
const char* name,
int stackSize,
int priority = 1,
95 xTaskCreatePinnedToCore(
task_loop, name, stackSize,
this, priority,
107 static void nop() { delay(100); }
FreeRTOS task.
Definition: TaskRTOS.h:23
TaskHandle_t & getTaskHandle()
Definition: TaskRTOS.h:74
TaskRTOS()
Definition: TaskRTOS.h:30
TaskHandle_t xHandle
Definition: TaskRTOS.h:85
void remove()
deletes the FreeRTOS task
Definition: TaskRTOS.h:37
std::function< void()> loop_code
Definition: TaskRTOS.h:86
~TaskRTOS()
Definition: TaskRTOS.h:34
bool begin(std::function< void()> process)
Definition: TaskRTOS.h:45
TaskRTOS(const char *name, int stackSize, int priority=1, int core=-1)
Defines and creates a FreeRTOS task.
Definition: TaskRTOS.h:26
void suspend()
Definition: TaskRTOS.h:55
void * getReference()
Definition: TaskRTOS.h:78
void * ref
Definition: TaskRTOS.h:87
void setReference(void *r)
Definition: TaskRTOS.h:76
void resume()
Definition: TaskRTOS.h:64
void end()
suspends the task
Definition: TaskRTOS.h:53
static void task_loop(void *arg)
Definition: TaskRTOS.h:109
bool create(const char *name, int stackSize, int priority=1, int core=-1)
If you used the empty constructor, you need to call create!
Definition: TaskRTOS.h:90
static void nop()
Definition: TaskRTOS.h:107
Definition: Allocator.h:13