From the course: Introduction to FreeRTOS and Basic Task Management

Unlock the full course today

Join today to access over 25,200 courses taught by industry experts.

Changing task priority at runtime

Changing task priority at runtime

- [Instructor] Let's see how to change the priority of a task in Runtime. To do that, let's first analyze what a project does. Lines 47 and 48 over here tells us that a project creates two tasks and they both have the same priority, priority level one. When we scroll down here to line 61 and line 74, we realize that both tasks simply increment their respective task profilers. Our job in this lesson is to let Task1 change the priority of Task2. To do this, we need task handles, so let's go up to line 31 and declare the task handles. I'll say TaskHandle_t and we're going to create two of them. I'll say task1_handle, and then task2_handle. Next, we have to update our xTaskCreate functions so that the returned task handles will be stored in these variables that we've created, so I'll copy task1_handle here and I'll come to the xTaskCreate function for Task1 at line 48 and I will update the last argument as &task1_handle. We have to pass the task handle address as the last argument and we…

Contents