FreeRTOScpp
Loading...
Searching...
No Matches
TaskClassS< stackDepth > Class Template Referenceabstract

Make a class based task. More...

#include <TaskCPP.h>

Inheritance diagram for TaskClassS< stackDepth >:
Collaboration diagram for TaskClassS< stackDepth >:

Public Member Functions

 TaskClassS (char const *name, TaskPriority priority_, unsigned portSHORT stackDepth_=0)
 Constructor.
 
virtual ~TaskClassS ()
 
TaskHandle_t getTaskHandle () const
 Get Task Handle.
 
bool give ()
 Notify a Task as a semaphore.
 
void give_ISR (portBASE_TYPE &waswoken)
 
bool notify (uint32_t value, eNotifyAction act)
 Notify a Task.
 
bool notify_ISR (uint32_t value, eNotifyAction act, portBASE_TYPE &waswoken)
 
bool notify_query (uint32_t value, eNotifyAction act, uint32_t &old)
 
bool notify_query_ISR (uint32_t value, eNotifyAction act, uint32_t &old, portBASE_TYPE &waswoken)
 
void priority (TaskPriority priority_)
 Set Task priority.
 
void resume ()
 Resume the Task.
 
void suspend ()
 Suspend the Task.
 
void task () override=0
 task function.
 

Static Public Member Functions

static void delay (TickType_t time)
 Delay for a period of time.
 
static uint32_t take (bool clear=true, TickType_t ticks=portMAX_DELAY)
 Wait for a task Give notification.
 
static uint32_t wait (uint32_t clearEnter, uint32_t clearExit=0xFFFFFFFF, uint32_t *value=nullptr, TickType_t ticks=portMAX_DELAY)
 Wait for task notification.
 

Protected Attributes

TaskHandle_t taskHandle
 Handle for the task we are managing.
 

Detailed Description

template<uint32_t stackDepth>
class TaskClassS< stackDepth >

Make a class based task.

Derive from TaskClass and the 'task()' member function will get called as the task based on the class.

Template Parameters
stackDepthSize of the stack to give to the task

If task() returns the task will be deleted if deletion has been enabled.

Constructor & Destructor Documentation

◆ TaskClassS()

template<uint32_t stackDepth>
TaskClassS< stackDepth >::TaskClassS ( char const * name,
TaskPriority priority_,
unsigned portSHORT stackDepth_ = 0 )
inline

Constructor.

Parameters
nameThe name of the task.
priority_The priority of the task. Use the TaskPriority enum values or a related value converted to a TaskPriority
stackDepth_How many words of stack to allocate to the task. Only used if the template parameter stackDepth is 0

API CHANGE! If at constrtuction time, the scheduler is not running, we can release the task. If the scheduler is running, because the task may startup before we finish constructing the task, the most derived constructor will need to give the task.

Change from previous API to support SMP mode where the previous trick won't work anymore.

References TaskBase::give().

Here is the call graph for this function:

◆ ~TaskClassS()

template<uint32_t stackDepth>
virtual TaskClassS< stackDepth >::~TaskClassS ( )
inlinevirtual

Member Function Documentation

◆ delay()

static void TaskBase::delay ( TickType_t time)
inlinestaticinherited

Delay for a period of time.

Parameters
timethe number of ticks to delay

This is a static member function as it affects the CALLING task, not the task it might be called on

◆ getTaskHandle()

TaskHandle_t TaskBase::getTaskHandle ( ) const
inlineinherited

Get Task Handle.

Returns
the task handle.

◆ give()

bool TaskBase::give ( )
inlineinherited

Notify a Task as a semaphore.

Sends a notification to a task using a semaphore based protocol. Generally the task should we using the take() function to receive the notification.

Referenced by TaskClassS< stackDepth >::TaskClassS().

Here is the caller graph for this function:

◆ give_ISR()

void TaskBase::give_ISR ( portBASE_TYPE & waswoken)
inlineinherited

◆ notify()

bool TaskBase::notify ( uint32_t value,
eNotifyAction act )
inlineinherited

Notify a Task.

Generic Task Notification operation

◆ notify_ISR()

bool TaskBase::notify_ISR ( uint32_t value,
eNotifyAction act,
portBASE_TYPE & waswoken )
inlineinherited

◆ notify_query()

bool TaskBase::notify_query ( uint32_t value,
eNotifyAction act,
uint32_t & old )
inlineinherited

◆ notify_query_ISR()

bool TaskBase::notify_query_ISR ( uint32_t value,
eNotifyAction act,
uint32_t & old,
portBASE_TYPE & waswoken )
inlineinherited

◆ priority()

void TaskBase::priority ( TaskPriority priority_)
inlineinherited

Set Task priority.

Only available if INCLUDE_vTaskPrioritySet == 1

Parameters
priority_The TaskPriority to give the Task.

◆ resume()

void TaskBase::resume ( )
inlineinherited

Resume the Task.

Only available if INCLUDE_vTaskSuspend == 1

◆ suspend()

void TaskBase::suspend ( )
inlineinherited

Suspend the Task.

Only available if INCLUDE_vTaskSuspend == 1

◆ take()

static uint32_t TaskBase::take ( bool clear = true,
TickType_t ticks = portMAX_DELAY )
inlinestaticinherited

Wait for a task Give notification.

Specialized wait() designed to work with the give()/give_ISR() notifications.

Parameters
clearFlag to indicate if the action on succesful take is to clear (True) or decrement (False) the notification value. Effectively decides between a binary (True) or counting (False) semaphore behavior.
ticksThe time to wait for the semaphore.
Returns
Returns the notification word (prior to being adjusted for the take() ), Will be zero if the take() timed out.

Referenced by taskcpp_task_thunk().

Here is the caller graph for this function:

◆ task()

template<uint32_t stackDepth>
void TaskClassS< stackDepth >::task ( )
overridepure virtual

task function.

The member function task needs to

Implements TaskClassBase.

◆ wait()

static uint32_t TaskBase::wait ( uint32_t clearEnter,
uint32_t clearExit = 0xFFFFFFFF,
uint32_t * value = nullptr,
TickType_t ticks = portMAX_DELAY )
inlinestaticinherited

Wait for task notification.

Member Data Documentation

◆ taskHandle

TaskHandle_t TaskBase::taskHandle
protectedinherited

Handle for the task we are managing.


The documentation for this class was generated from the following file: