Complete the code to define the FreeRTOS idle hook function.
void vApplicationIdleHook(void) {
[1];
}vTaskDelay() inside the idle hook causes unexpected delays.xTaskCreate() inside the idle hook is incorrect.The idle hook function often calls taskYIELD() to allow other tasks to run.
Complete the code to enable the idle hook in FreeRTOSConfig.h.
#define configUSE_IDLE_HOOK [1]
Setting configUSE_IDLE_HOOK to 1 enables the idle hook function.
Fix the error in the idle hook function to prevent blocking calls.
void vApplicationIdleHook(void) {
[1];
}vTaskDelay() blocks the idle task and can cause system issues.The idle hook must not block. Using taskYIELD() allows other tasks to run without blocking.
Fill both blanks to create a dictionary comprehension that maps task names to their states if the task is running.
task_states = {task->pcTaskName: task->eCurrentState for task in [1] if task->eCurrentState [2] eRunning}!= eRunning selects non-running tasks.eSuspended instead of a function causes errors.Use pxTaskGetSystemState() to get tasks and == to check if the task is running.
Fill all three blanks to define an idle hook that toggles an LED when the system is idle and yields control.
void vApplicationIdleHook(void) {
[1]();
[2] = ![3];
taskYIELD();
}vTaskDelay() inside idle hook causes blocking.The idle hook toggles the LED by calling ToggleLED() and flipping ledState, then yields.