From the course: Introduction to FreeRTOS and Basic Task Management
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Suspending a task
From the course: Introduction to FreeRTOS and Basic Task Management
Suspending a task
- [Instructor] In this lesson, we're going to learn how to suspend a task and we're going to make it more interesting by monitoring a variable to determine when to suspend a task. Let's start by analyzing what a current project does. So over here at line 50 and 51, we find out that the project creates two tasks and they both have the same priority level. When we scroll down to the task functions at lines 64 and 81, we realize that task1 does a bit of work by counting from 1 to 100,000 and then increments its task profiler. Task2, on the other hand, simply increments its task profiler. Our job in this lesson is to increment a global variable that we shall call the suspend_monitor. And when this global variable crosses a particular threshold, we would suspend task2. So let's start off by defining this threshold at our TODO item one over here. So I'll come to line nine and say define. We'll call this SUSPEND_THRESH and we'll set it to 150, meaning 150 iterations. After 150 iterations…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
The task creation and deletion functions1m 26s
-
(Locked)
Creating Task Profilers and Task Functions4m 38s
-
(Locked)
Creating tasks in FreeRTOS5m 16s
-
(Locked)
Controlling hardware from different tasks3m 56s
-
(Locked)
Passing parameters to tasks5m 56s
-
(Locked)
The task priority functions54s
-
(Locked)
Understanding preemption1m 54s
-
(Locked)
Experimenting with different task priorities4m 24s
-
(Locked)
Changing task priority at runtime3m 59s
-
(Locked)
Reading task priority3m 29s
-
(Locked)
The task suspension and resumption functions1m 1s
-
(Locked)
Suspending a task4m 18s
-
(Locked)
Resuming a suspended task6m 29s
-
(Locked)
Deleting a task in FreeRTOS4m 50s
-
(Locked)
-
-