0
0
FreeRTOSprogramming~10 mins

Task handle usage 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 create a task and store its handle.

FreeRTOS
TaskHandle_t [1] = NULL;
xTaskCreate(taskFunction, "Task1", 1000, NULL, 1, &handle);
Drag options to blanks, or click blank then click option'
Ahandle
BtaskHandle
Ctask1Handle
DxHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name not matching the one passed to xTaskCreate.
Not declaring the handle variable before use.
2fill in blank
medium

Complete the code to delete a task using its handle.

FreeRTOS
vTaskDelete([1]);
Drag options to blanks, or click blank then click option'
ANULL
BxHandle
Chandle
DtaskHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Passing NULL to vTaskDelete deletes the current task, not the target task.
Using an undefined variable.
3fill in blank
hard

Fix the error in the code to suspend a task using its handle.

FreeRTOS
vTaskSuspend([1]);
Drag options to blanks, or click blank then click option'
AtaskHandle
Bhandle
CNULL
DxHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Passing NULL instead of the task handle.
Using a different variable name than the one storing the handle.
4fill in blank
hard

Fill both blanks to resume a suspended task using its handle and check if the handle is valid.

FreeRTOS
if ([1] != NULL) {
    vTaskResume([2]);
}
Drag options to blanks, or click blank then click option'
Ahandle
BtaskHandle
CNULL
DxHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variables for the check and resume call.
Not checking if the handle is NULL before resuming.
5fill in blank
hard

Fill all three blanks to create a task, store its handle, and then delete it.

FreeRTOS
TaskHandle_t [1] = NULL;
xTaskCreate(taskFunction, "Task2", 1000, NULL, 1, &[2]);
vTaskDelete([3]);
Drag options to blanks, or click blank then click option'
Ahandle2
DtaskHandle2
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for declaration, creation, and deletion.
Not passing the address of the handle variable to xTaskCreate.