FreeRTOS Quick Reference Guide

FreeRTOS Quick Reference Guide

This contains examples of the most common functions, designed to jog your memory when writing FreeRTOS code.

Function Comments
GENERAL TASK MANIPULATION  
Will block current task for 200ms.
Stops scheduler, but not interrupts. Do not call non-interrupt FreeRTOS API from within a suspend section.
Used to create a software timer, based of the system ticks. #configUSE_TIMERS has to be set to 1 and #configTIMER_TASK_PRIORITY set before this function is available (in “FreeRTOSConfig.h”).
TASK MAINTENANCE/DEBUG  
Writes a task list to a debug buffer. Recommended to have about 40 bytes of space in the buffer per task.
Returns system debug information for 5 tasks (fuction added in v7.5.0). Stores total run time into 3rd argument.
QUEUES  
Creates a queue of length 50 (elements) and width 2 (bytes).
 
Puts item onto the end of the queue. Standard way of putting data onto queue.
SEMAPHORES  
Use for mutual exclusion (to prevent contention problems).
Creates a mutex.
Creates a binary semaphore. Use for interrupt-to-task synchronisation
Creates a counting semaphore which counts to 10, and starts counting from 0 (so 10 free at creation).
Gives a semaphore.
Interrupt safe version of xSemaphoreGive().

tskIDLE_PRIORITY – Priority of the idle task. Usually used as a way of setting the priority of other tasks relative to the idle task (e.g. tskIDLE_PRIORITY + 1). portTICK_RATE_MS –  Period of the ticks (in milli-seconds). Used when calling timing/delay functions so that you can specify a delay in ms rather than ticks