Task1, Task2, and Task3.delay_time to control blocking duration.eTaskGetState().Task1, Task2, and Task3.delay_time to control blocking duration.eTaskGetState().Task1, Task2, and Task3 using xTaskCreate(). Each task should run a simple function that loops infinitely. Use vTaskDelay(1) inside each task to allow context switching.Use xTaskCreate() to create each task with a stack size of 1000 and priority 1. Then start the scheduler with vTaskStartScheduler().
delay_time of type TickType_t and set it to pdMS_TO_TICKS(1000) to represent a 1000 ms delay.Use TickType_t delay_time = pdMS_TO_TICKS(1000); to set a 1-second delay.
Task2 to call vTaskDelay(delay_time) inside its loop to enter the Blocked state. Modify Task3 to suspend itself once using vTaskSuspend(NULL) to enter the Suspended state.Use vTaskDelay(delay_time); in Task2's loop and call vTaskSuspend(NULL); once at the start of Task3.
main(), after creating the tasks, declare three TaskHandle_t variables named handle1, handle2, and handle3. Pass their addresses to xTaskCreate() to get the task handles. Then print the state of each task using eTaskGetState() and printf(). Use the format: "Task1 state: %d\n", "Task2 state: %d\n", and "Task3 state: %d\n".Use TaskHandle_t variables to get task handles from xTaskCreate(). Then print each task's state using eTaskGetState() and printf(). The states are integers representing Ready (2), Blocked (3), and Suspended (4).
Which FreeRTOS task state means the task is waiting to be assigned CPU time but is ready to run?
Which of the following is the correct way to suspend a task in FreeRTOS?
void suspendTask(TaskHandle_t task) {
// What function to call?
}Consider this FreeRTOS code snippet:
void vTaskFunction(void *pvParameters) {
for (;;) {
if (xSemaphoreTake(xSemaphore, 0) == pdTRUE) {
// Critical section
} else {
vTaskDelay(pdMS_TO_TICKS(100));
}
}
}What is the state of the task when vTaskDelay() is called?
Identify the error in this FreeRTOS task management code:
vTaskSuspend(NULL);
vTaskResume(NULL);
vTaskResume(xTaskHandle);What is wrong with this code?
You want to create a task that waits for a button press event without using CPU time unnecessarily. Which task state should the task enter while waiting?
Pass the test and this pattern moves unknown