Complete the code to start the FreeRTOS scheduler.
vTaskStartScheduler[1];The function vTaskStartScheduler() starts the FreeRTOS scheduler and takes no parameters, so it requires parentheses ().
Complete the code to create a task with priority 2.
xTaskCreate(TaskFunction, "Task1", 1000, NULL, [1], NULL);
The priority parameter in xTaskCreate sets the task priority. Here, priority 2 is required.
Fix the error in the task delay function to yield control correctly.
vTaskDelay([1]);portTICK_PERIOD_MS.The vTaskDelay() function expects a delay in ticks. To delay 1000 milliseconds, divide by portTICK_PERIOD_MS.
Fill both blanks to create a preemptive scheduler configuration.
configUSE_PREEMPTION = [1]; configMAX_PRIORITIES = [2];
configUSE_PREEMPTION to 0 disables preemption.Setting configUSE_PREEMPTION to 1 enables preemptive scheduling. configMAX_PRIORITIES defines the number of priority levels; 5 is a common choice.
Fill all three blanks to correctly implement a task function that yields control.
void TaskFunction(void *pvParameters) {
for(;;) {
// Task code here
[1]();
[2](10 / [3]);
}
}vTaskDelayUntil without proper tick count variable.taskYIELD() forces the task to yield control immediately. vTaskDelay() delays the task for a number of ticks, which is calculated by dividing milliseconds by portTICK_PERIOD_MS.