The idle task can optionally call an application defined hook (or callback) function - the idle hook. The idle task runs at the very lowest priority, so such an idle hook
function will only get executed when there are no tasks of higher priority that are able to run. This makes the idle hook function an ideal place to put
the processor into a low power state - providing an automatic power saving whenever there is no processing to be performed.
The idle hook will only get called if configUSE_IDLE_HOOK is set to 1 within FreeRTOSConfig.h. When this is set the application must provide the hook
function with the following prototype:
void vApplicationIdleHook( void );
The idle hook is called repeatedly as long as the idle task is running. It is paramount that the idle hook function does not call any API functions
that could cause it to block. Also, if the application makes use of the vTaskDelete() API function then the idle task hook must be allowed to periodically return
(this is because the idle task is responsible for cleaning up the resources that were allocated by the RTOS kernel to the task that has been deleted).
Defining the malloc() failure hook will help identify problems caused by lack of heap memory - especially when a call to pvPortMalloc() fails within
an API function.
The malloc failed hook will only get called if configUSE_MALLOC_FAILED_HOOK is set to 1 within FreeRTOSConfig.h. When this is set the application
must provide the hook function with the following prototype:
Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2013 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM 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.