freeRTOS The Idle Task and the Idle Task Hook
Idle Task There must always be at least one task that can enter the Running state. To ensure this is the case, an Idle task is automatically created by the scheduler when vTaskStartScheduler() is called. The idle task does very little more than sit in a loop—it is always able to run. The idle task has the lowest possible priority ( priority zero ), to ensure it never prevents a higher priority application task from entering the Running state—although there is nothing to prevent application designers creating tasks at, and therefore sharing, the idle task priority, if desired. Note: If an application uses the vTaskDelete() API function then it is essential that the Idle task is not starved of processing time. This is because the Idle task is responsible for cleaning up kernel resources after a task has been deleted. Idle Task Hook Functions It is possible to add application specific functionality directly into the idle task through the use of an idle hook (or idle cal...