FreeRTOS-Cpp
|
Class that encapsulates the functionality of a FreeRTOS task. More...
#include <Task.hpp>
Public Member Functions | |
StaticTask (const StaticTask &)=delete | |
StaticTask & | operator= (const StaticTask &)=delete |
![]() | |
TaskBase (const TaskBase &)=delete | |
TaskBase & | operator= (const TaskBase &)=delete |
virtual void | taskEntry () final |
Function that acts as the entry point of the task instance. This function initializes the previous wake time of the task and calls the user implemented taskFunction(). More... | |
UBaseType_t | getPriority () const |
Function that calls UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) More... | |
void | setPriority (const UBaseType_t newPriority) const |
Function that calls void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) More... | |
void | suspend () const |
Function that calls void vTaskSuspend( TaskHandle_t xTaskToSuspend ) More... | |
void | resume () const |
Function that calls void vTaskResume( TaskHandle_t xTaskToResume ) More... | |
bool | resumeFromISR () const |
Function that calls BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) More... | |
bool | abortDelay () const |
Function that calls BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) More... | |
UBaseType_t | getStackHighWaterMark () const |
Function that calls UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) More... | |
configSTACK_DEPTH_TYPE | getStackHighWaterMark2 () const |
Function that calls UBaseType_t uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) More... | |
State | getState () const |
Function that calls UBaseType_t uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) More... | |
const char * | getName () const |
Function that calls char *pcTaskGetName( TaskHandle_t xTaskToQuery ) More... | |
void | notifyGive (const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyGiveIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify ) More... | |
void | notifyGiveFromISR (bool &higherPriorityTaskWoken, const UBaseType_t index=0) const |
Function that calls void vTaskNotifyGiveIndexedFromISR( TaskHandle_t xTaskHandle, UBaseType_t uxIndexToNotify, BaseType_t *pxHigherPriorityTaskWoken ) More... | |
void | notifyGiveFromISR (const UBaseType_t index=0) const |
Function that calls void vTaskNotifyGiveIndexedFromISR( TaskHandle_t xTaskHandle, UBaseType_t uxIndexToNotify, BaseType_t *pxHigherPriorityTaskWoken ) More... | |
bool | notify (const NotifyAction action, const NotificationBits value=0, const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction ) More... | |
std::pair< bool, NotificationBits > | notifyAndQuery (const NotifyAction action, const NotificationBits value=0, const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyAndQueryIndexed( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue ) More... | |
std::pair< bool, NotificationBits > | notifyAndQueryFromISR (bool &higherPriorityTaskWoken, const NotifyAction action, const NotificationBits value=0, const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyAndQueryIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue, BaseType_t *pxHigherPriorityTaskWoken ) More... | |
std::pair< bool, NotificationBits > | notifyAndQueryFromISR (const NotifyAction action, const NotificationBits value=0, const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyAndQueryIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue, BaseType_t *pxHigherPriorityTaskWoken ) More... | |
bool | notifyFromISR (bool &higherPriorityTaskWoken, const NotifyAction action, const NotificationBits value=0, const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ) More... | |
bool | notifyFromISR (const NotifyAction action, const NotificationBits value=0, const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyIndexedFromISR( TaskHandle_t xTaskToNotify, UBaseType_t uxIndexToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ) More... | |
bool | notifyStateClear (const UBaseType_t index=0) const |
Function that calls BaseType_t xTaskNotifyStateClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToClear ) More... | |
NotificationBits | notifyValueClear (const NotificationBits bitsToClear=0, const UBaseType_t index=0) const |
Function that calls uint32_t ulTaskNotifyValueClearIndexed( TaskHandle_t xTask, UBaseType_t uxIndexToClear, uint32_t ulBitsToClear ) More... | |
Protected Member Functions | |
StaticTask (const UBaseType_t priority=tskIDLE_PRIORITY, const char *name="") | |
Construct a new Task object by calling TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) More... | |
StaticTask (StaticTask &&) noexcept=default | |
StaticTask & | operator= (StaticTask &&) noexcept=default |
![]() | |
virtual void | taskFunction ()=0 |
Abstraction function that acts as the entry point of the task for the user. More... | |
bool | delayUntil (const TickType_t timeIncrement=0) |
Function that calls BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement ) More... | |
Private Attributes | |
StaticTask_t | taskBuffer |
StackType_t | stack [N] |
Additional Inherited Members | |
![]() | |
enum class | State { Running = eRunning , Ready = eReady , Blocked = eBlocked , Suspended = eSuspended , Deleted = eDeleted , Invalid = eInvalid } |
enum class | NotifyAction { NoAction = eNoAction , SetBits = eSetBits , Increment = eIncrement , SetValueWithOverwrite = eSetValueWithOverwrite , SetValueWithoutOverwrite = eSetValueWithoutOverwrite } |
using | NotificationBits = std::bitset< 32 > |
![]() | |
static void * | operator new (size_t, void *ptr) |
static void * | operator new[] (size_t, void *ptr) |
static void * | operator new (size_t)=delete |
static void * | operator new[] (size_t)=delete |
static TaskHandle_t | getIdleHandle () |
Function that calls TaskHandle_t xTaskGetIdleTaskHandle( void ) More... | |
static TaskHandle_t | getHandle (const char *name) |
Function that calls TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ) More... | |
static std::pair< bool, NotificationBits > | notifyWait (const TickType_t ticksToWait=portMAX_DELAY, const NotificationBits bitsToClearOnEntry=0, const NotificationBits bitsToClearOnExit=0, const UBaseType_t index=0) |
Function that calls BaseType_t xTaskNotifyWaitIndexed( UBaseType_t uxIndexToWaitOn, uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) More... | |
![]() | |
static void | delay (const TickType_t ticksToDelay=0) |
Function that calls void vTaskDelay( const TickType_t xTicksToDelay ) More... | |
static NotificationBits | notifyTake (const TickType_t ticksToWait=portMAX_DELAY, const bool clearCountOnExit=true, const UBaseType_t index=0) |
Function that calls uint32_t ulTaskNotifyTakeIndexed( UBaseType_t uxIndexToWaitOn, BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) More... | |
Class that encapsulates the functionality of a FreeRTOS task.
StaticTask Task.hpp <FreeRTOS/Task.hpp>
Each task requires RAM that is used to hold the task state, and used by the task as its stack. If a task is created using this class then the RAM is included in the object. If a task is created using FreeRTOS::Task() then the required RAM is automatically allocated from the FreeRTOS heap. See the Static Vs Dynamic allocation page for more information.
N | The number of indexes in the array of StackType_t used to store the stack for this task. |
|
inlineexplicitprotected |
Construct a new Task object by calling TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer )
xTaskCreateStatic
the constructor passes the this
pointer as the task function argument. This pointer is used so that the interface function callTaskFunction() can invoke taskEntry() for this instance of the class.priority | The priority at which the created task will execute. Priorities are asserted to be less than configMAX_PRIORITIES. If configASSERT is undefined, priorities are silently capped at (configMAX_PRIORITIES - 1). |
name | A descriptive name for the task. This is mainly used to facilitate debugging, but can also be used to obtain a task handle. The maximum length of a task's name is defined by configMAX_TASK_NAME_LEN in FreeRTOSConfig.h. |
Example Usage