Complete the code to declare the variable that stores the last wake time for precise delay.
TickType_t [1] = xTaskGetTickCount();The variable xLastWakeTime stores the last wake time and is used with vTaskDelayUntil() for precise timing.
Complete the code to delay the task precisely for 100 ticks using vTaskDelayUntil.
vTaskDelayUntil(&[1], pdMS_TO_TICKS(100));
vTaskDelay() instead of vTaskDelayUntil().The function vTaskDelayUntil() requires a pointer to xLastWakeTime to maintain precise periodic timing.
Fix the error in the code to correctly use vTaskDelayUntil for a 500 ms delay.
TickType_t xLastWakeTime = xTaskGetTickCount(); vTaskDelayUntil([1], pdMS_TO_TICKS(500));
vTaskDelayUntil() requires a pointer to the last wake time variable, so &xLastWakeTime is correct.
Fill both blanks to create a periodic task that delays precisely for 200 ms.
TickType_t [1] = xTaskGetTickCount(); vTaskDelayUntil(&[2], pdMS_TO_TICKS(200));
Both blanks should be xLastWakeTime to correctly track and update the last wake time for precise delays.
Fill all three blanks to implement a task that toggles an LED every 250 ms using vTaskDelayUntil.
void vTaskToggleLED(void *pvParameters) {
TickType_t [1] = xTaskGetTickCount();
for(;;) {
toggleLED();
vTaskDelayUntil(&[2], pdMS_TO_TICKS([3]));
}
}The variable xLastWakeTime is used to track the last wake time, and the delay is set to 250 ms for toggling the LED periodically.