0
0
FreeRTOSprogramming~10 mins

Idle task and idle hook in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the FreeRTOS idle hook function.

FreeRTOS
void vApplicationIdleHook(void) {
    [1];
}
Drag options to blanks, or click blank then click option'
Aprintf("Idle\n")
BvTaskDelay(100)
CtaskYIELD()
DxTaskCreate()
Attempts:
3 left
💡 Hint
Common Mistakes
Using vTaskDelay() inside the idle hook causes unexpected delays.
Calling xTaskCreate() inside the idle hook is incorrect.
2fill in blank
medium

Complete the code to enable the idle hook in FreeRTOSConfig.h.

FreeRTOS
#define configUSE_IDLE_HOOK [1]
Drag options to blanks, or click blank then click option'
A1
Btrue
C2
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 disables the idle hook.
Using 'true' instead of 1 may cause configuration errors.
3fill in blank
hard

Fix the error in the idle hook function to prevent blocking calls.

FreeRTOS
void vApplicationIdleHook(void) {
    [1];
}
Drag options to blanks, or click blank then click option'
AtaskYIELD()
Bwhile(1) {}
CvTaskSuspend(NULL)
DvTaskDelay(10)
Attempts:
3 left
💡 Hint
Common Mistakes
Using vTaskDelay() blocks the idle task and can cause system issues.
Infinite loops without yielding prevent other tasks from running.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps task names to their states if the task is running.

FreeRTOS
task_states = {task->pcTaskName: task->eCurrentState for task in [1] if task->eCurrentState [2] eRunning}
Drag options to blanks, or click blank then click option'
ApxTaskGetSystemState()
BeSuspended
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using != eRunning selects non-running tasks.
Using eSuspended instead of a function causes errors.
5fill in blank
hard

Fill all three blanks to define an idle hook that toggles an LED when the system is idle and yields control.

FreeRTOS
void vApplicationIdleHook(void) {
    [1]();
    [2] = ![3];
    taskYIELD();
}
Drag options to blanks, or click blank then click option'
AToggleLED
BledState
DvTaskDelay
Attempts:
3 left
💡 Hint
Common Mistakes
Using vTaskDelay() inside idle hook causes blocking.
Not toggling the LED state variable causes no visible change.