Complete the code to create a FreeRTOS task named "Task1".
xTaskCreate([1], "Task1", 100, NULL, 1, NULL);
The first argument to xTaskCreate() is the function that implements the task.
Complete the code to set the stack size of the task to 256 words.
xTaskCreate(TaskFunction, "Task2", [1], NULL, 2, NULL);
The third argument to xTaskCreate() is the stack size in words. Here, 256 is used.
Fix the error in the priority argument to create a high priority task.
xTaskCreate(TaskFunction, "Task3", 200, NULL, [1], NULL);
Task priority must be less than configMAX_PRIORITIES. The highest valid priority is configMAX_PRIORITIES - 1.
Fill both blanks to create a task with a handle and check if creation was successful.
TaskHandle_t [1] = NULL; BaseType_t result = xTaskCreate(TaskFunction, "Task4", 150, NULL, 1, [2]); if (result == pdPASS) { // Task created successfully }
The task handle variable is declared as taskHandle. The address of this variable &taskHandle is passed to xTaskCreate() to receive the handle.
Fill all three blanks to create a task with a parameter, priority 3, and store its handle.
int param = 10; TaskHandle_t [1] = NULL; BaseType_t result = xTaskCreate(TaskFunction, "Task5", 120, [2], [3], &taskHandle);
The task handle variable is taskHandle. The parameter passed to the task is param. The priority is set to 3.