modm API documentation
RTOS Abstractions

Classes

class  modm::rtos::BinarySemaphore
 Binary semaphore More...
 
class  modm::rtos::Mutex
 Mutex More...
 
class  modm::rtos::MutexGuard
 
class  modm::rtos::Queue< T >
 Queue More...
 
class  modm::rtos::Scheduler
 
class  modm::rtos::Semaphore
 Counting semaphore More...
 
class  modm::rtos::Thread
 Thread More...
 

Macros

#define TIME_LOOP(frequency)
 Create a timed periodic loop. More...
 
#define MILLISECONDS
 Convert between scheduler ticks and milliseconds. More...
 

Detailed Description

lbuild module: modm:processing:rtos

Basic building blocks of an RTOS abstracted as C++ classes and implemented either with FreeRTOS or stdlibc++.

Macro Definition Documentation

#define MILLISECONDS

Convert between scheduler ticks and milliseconds.

For example 20 ms in scheduler ticks might be written as:

This should only be used with constant values as the calculation is done using floating point. For constant values the compiler will do the calculation at compile time.

For non constant value use the following formula:

static_cast<TickType_t>((time * configTICK_RATE_HZ) / 1000)

The parentheses are important because otherwise the division might be done first which will lead to wrong results.

#define TIME_LOOP

Create a timed periodic loop.

Example:

void
Thread::run()
{
{
// will be executed every 20ms
}
}
Parameters
frequencyFrequency in ticks
See also
MILLISECONDS
vTaskDelayUntil() from FreeRTOS