Complete the code to create a FreeRTOS task.
xTaskCreate([1], "Task1", 1000, NULL, 1, NULL);
The function vTaskFunction is the task function passed to xTaskCreate to define the task's behavior.
Complete the code to start the FreeRTOS scheduler.
int main(void) {
// Setup code
[1]();
for(;;); // Should never reach here
}vTaskStartScheduler() starts the FreeRTOS scheduler which begins running tasks.
Fix the error in the task delay call to correctly delay for 1000 milliseconds.
void vTaskFunction(void *pvParameters) {
for(;;) {
[1](1000 / portTICK_PERIOD_MS);
}
}vTaskDelay() delays a task for a number of tick periods. The argument is in ticks, so 1000 milliseconds must be converted to ticks using 1000 / portTICK_PERIOD_MS.
Fill both blanks to create a dictionary comprehension that maps task names to their priorities if priority is greater than 2.
task_priorities = {task[1]: priority for task, priority in tasks.items() if priority [2] 2}Access the task's name with .name and filter priorities greater than 2 with >.
Fill all three blanks to create a dictionary comprehension that maps uppercase task names to their priorities if priority is greater than 0.
task_map = [1]: [2] for task, priority in tasks.items() if priority [3] 0}}
Use task.upper() for uppercase keys, priority as values, and filter with > 0.