Complete the code to create a FreeRTOS task named "Task1".
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() {
// Create tasks here
[1]();
for(;;);
}The function vTaskStartScheduler() starts the FreeRTOS scheduler, which begins running the created tasks.
Fix the error in the task delay call to delay for 1000 milliseconds.
void vTaskFunction(void *pvParameters) {
for(;;) {
// Do work
vTaskDelay([1]);
}
}The macro pdMS_TO_TICKS(1000) converts 1000 milliseconds to the correct tick count for vTaskDelay.
Fill both blanks to create two tasks with different priorities.
xTaskCreate(Task1Function, "Task1", 1000, NULL, [1], NULL); xTaskCreate(Task2Function, "Task2", 1000, NULL, [2], NULL);
Task1 has priority 1 and Task2 has priority 2, so Task2 runs with higher priority.
Fill all three blanks to create a task that deletes itself after running once.
void vOneShotTask(void *pvParameters) {
// Task code here
[1](pdMS_TO_TICKS(1000));
[2](NULL);
for(;;) {
[3](NULL);
}
}The task delays briefly, then deletes itself with vTaskDelete(NULL).