FreeRTOS Addons
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
cpp_freertos::Tasklet Class Referenceabstract

#include <tasklet.hpp>

Public Member Functions

 Tasklet ()
 
virtual ~Tasklet ()
 
bool Schedule (uint32_t parameter, TickType_t CmdTimeout=portMAX_DELAY)
 
bool ScheduleFromISR (uint32_t parameter, BaseType_t *pxHigherPriorityTaskWoken)
 

Protected Member Functions

void CheckForSafeDelete ()
 
virtual void Run (uint32_t parameter)=0
 

Detailed Description

A FreeRTOS wrapper for its concept of a Pended Function. In Linux, one permutation of this would be a Tasklet, or bottom half processing from an ISR.

This is an abstract base class. To use this, you need to subclass it. All of your Tasklets should be derived from the Tasklet class. Then implement the virtual Run function. This is a similar design to Java threading.

Constructor & Destructor Documentation

◆ Tasklet()

Tasklet::Tasklet ( )

Constructor

Note
Do not construct inside an ISR! This includes creating local instances of this object.

◆ ~Tasklet()

Tasklet::~Tasklet ( )
virtual

Destructor

Note
Do not delete inside an ISR! This includes the automatic deletion of local instances of this object when leaving scope.

Member Function Documentation

◆ CheckForSafeDelete()

void Tasklet::CheckForSafeDelete ( )
protected

You must call this in your dtor, to synchronize between being called and being deleted.

◆ Run()

virtual void cpp_freertos::Tasklet::Run ( uint32_t  parameter)
protectedpure virtual

Implementation of your actual tasklet code. You must override this function.

Parameters
parameterValue passed to you from the Schedule() methods.

◆ Schedule()

bool Tasklet::Schedule ( uint32_t  parameter,
TickType_t  CmdTimeout = portMAX_DELAY 
)

Schedule this Tasklet to run.

Parameters
parameterValue passed to your Run method.
CmdTimeoutHow long to wait to send this command to the timer daemon.
Returns
true if this command will be sent to the timer daemon, false if it will not (i.e. timeout).

◆ ScheduleFromISR()

bool Tasklet::ScheduleFromISR ( uint32_t  parameter,
BaseType_t *  pxHigherPriorityTaskWoken 
)

Schedule this Tasklet to run from ISR context. This allows FreeRTOS ISRs to defer processing from the ISR into a task context.

Parameters
parameterValue passed to your Run method.
pxHigherPriorityTaskWokenDid this operation result in a rescheduling event.
Returns
true if this command will be sent to the timer daemon, false if it will not (i.e. timeout).

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