Homepage | FAQ

FreeRTOS FAQ - Tick and Idle Hooks

Can I add code to the RTOS idle task?

Is there an Idle hook?
Is there a tick or context switch hook?

FAQ Top



Can I add code to the RTOS idle task?

The idle task is implemented in Source/tasks.c. Look for prvIdleTask. You can add what you like provided the added code does not make the idle task block. Maybe add some code to put the microcontroller into power save mode? The most convenient way of achieving this is through the use of an idle task hook.



Is there an Idle hook?

Yes if you set configUSE_IDLE_HOOK to 1 in the projects FreeRTOSConfig.h file.



Is there a tick or context switch hook?

Yes if you set configUSE_TICK_HOOK to 1 in the projects FreeRTOSConfig.h file.







Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2011 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOS distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd..