0
0
FreeRTOSprogramming~10 mins

Critical sections and interrupt disabling 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 enter a critical section using FreeRTOS API.

FreeRTOS
taskENTER_CRITICAL();
// Critical code here
[1]();
Drag options to blanks, or click blank then click option'
AtaskEXIT_CRITICAL
BtaskENTER_CRITICAL
CtaskENTER_CRITICAL()
DtaskEXIT_CRITICAL()
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the parentheses when calling the function.
Using the enter function instead of the exit function.
2fill in blank
medium

Complete the code to disable interrupts in FreeRTOS.

FreeRTOS
[1]();
// Critical code here
portENABLE_INTERRUPTS();
Drag options to blanks, or click blank then click option'
AportDISABLE_INTERRUPTS
BportENABLE_INTERRUPTS()
CportDISABLE_INTERRUPTS()
DportENABLE_INTERRUPTS
Attempts:
3 left
💡 Hint
Common Mistakes
Calling the enable interrupts function instead of disable.
Omitting parentheses when calling the function.
3fill in blank
hard

Fix the error in the code to properly exit a critical section.

FreeRTOS
taskENTER_CRITICAL();
// Critical code
[1];
Drag options to blanks, or click blank then click option'
AtaskEXIT_CRITICAL
BtaskEXIT_CRITICAL()
CtaskENTER_CRITICAL()
DtaskENTER_CRITICAL
Attempts:
3 left
💡 Hint
Common Mistakes
Missing parentheses causing the function not to execute.
Using the enter function instead of exit.
4fill in blank
hard

Fill both blanks to create a critical section that disables interrupts and then enables them.

FreeRTOS
void critical_function() {
    [1]();
    // Critical code here
    [2]();
}
Drag options to blanks, or click blank then click option'
AportDISABLE_INTERRUPTS
BportENABLE_INTERRUPTS
CtaskENTER_CRITICAL
DtaskEXIT_CRITICAL
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing enter/exit critical section functions with interrupt macros.
Forgetting parentheses on function calls.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps task names to their priority if priority is above 3.

FreeRTOS
task_priorities = { [1]: [2] for [1] in tasks if [2] > 3 }
Drag options to blanks, or click blank then click option'
Atask.name
Btask.priority
Ctask
Dpriority
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined variables like 'priority' instead of 'task.priority'.
Mixing keys and values incorrectly in the comprehension.