19#ifndef FREERTOS_TASK_H
20#define FREERTOS_TASK_H
51 FrameworkTask(
const char *name, uint16_t stackSize = 1024, UBaseType_t priority = 1);
103 void notify(uint8_t index, uint32_t value = 1);
113 void notifyFromISR(uint8_t index, uint32_t value = 1, BaseType_t *pxHigherPriorityTaskWoken =
nullptr);
127 bool waitFor(uint8_t index, TickType_t timeout = portMAX_DELAY);
152 uint32_t
waitFor(TickType_t timeout = portMAX_DELAY);
168 bool sendToQueue(
const void *item, TickType_t timeout = 0);
Defines the Event structure and related utilities for event messaging.
Base class for FreeRTOS-aware tasks in the framework.
void notifyFromISR(uint8_t index, uint32_t value=1, BaseType_t *pxHigherPriorityTaskWoken=nullptr)
Sends a notification from an ISR (by index).
virtual ~FrameworkTask()
Destructor.
virtual void onEvent(const Event &event)
Called when the task receives an event.
TaskHandle_t getHandle() const
Returns the FreeRTOS task handle.
void resume()
Resumes the task using vTaskResume().
void notify(uint8_t index, uint32_t value=1)
Sends a notification to this task using an index.
void suspend()
Suspends the task using vTaskSuspend().
const char * getName() const
Returns the task name.
bool waitFor(uint8_t index, TickType_t timeout=portMAX_DELAY)
Waits for a notification (by index).
bool createQueue(size_t itemSize, size_t length)
Creates an internal FreeRTOS queue.
static void taskEntry(void *pvParams)
Notification waitForAny(uint8_t index, uint32_t mask, TickType_t timeout=portMAX_DELAY)
waits for any notification matching the given mask.
bool start()
Starts the task via FreeRTOS.
virtual void run()=0
Main task loop.
bool receiveFromQueue(void *item, TickType_t timeout=portMAX_DELAY)
Receives an item from the internal queue.
bool sendToQueue(const void *item, TickType_t timeout=0)
Sends an item to the internal queue.
Represents a framework event, optionally carrying payload data.
A tagged union representing either a system or user-defined notification.