0
0
FreeRTOSprogramming~10 mins

FreeRTOS architecture overview - Interactive Code Practice

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

Complete the code to create a FreeRTOS task.

FreeRTOS
xTaskCreate([1], "Task1", 1000, NULL, 1, NULL);
Drag options to blanks, or click blank then click option'
AvTaskFunction
BvTaskDelay
CvTaskStartScheduler
DvTaskDelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using scheduler or delay functions instead of the task function.
Passing NULL instead of a function name.
2fill in blank
medium

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
int main(void) {
    // Setup code
    [1]();
    for(;;); // Should never reach here
}
Drag options to blanks, or click blank then click option'
AvTaskDelay
BvTaskDelete
CxTaskCreate
DvTaskStartScheduler
Attempts:
3 left
💡 Hint
Common Mistakes
Calling task creation functions instead of starting the scheduler.
Using delay functions to start the scheduler.
3fill in blank
hard

Fix the error in the task delay call to correctly delay for 1000 milliseconds.

FreeRTOS
void vTaskFunction(void *pvParameters) {
    for(;;) {
        [1](1000 / portTICK_PERIOD_MS);
    }
}
Drag options to blanks, or click blank then click option'
AvTaskDelay(1000)
BvTaskDelayMs
CvTaskDelay
Ddelay
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-FreeRTOS delay functions.
Passing the delay time inside the function call in the blank.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps task names to their priorities if priority is greater than 2.

FreeRTOS
task_priorities = {task[1]: priority for task, priority in tasks.items() if priority [2] 2}
Drag options to blanks, or click blank then click option'
A.name
B<=
C>
D.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property names like .id instead of .name.
Using wrong comparison operators like <= instead of >.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase task names to their priorities if priority is greater than 0.

FreeRTOS
task_map = [1]: [2] for task, priority in tasks.items() if priority [3] 0}}
Drag options to blanks, or click blank then click option'
Atask.upper()
Bpriority
C>
Dtask.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase instead of uppercase for task names.
Using wrong comparison operators like < instead of >.