-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
42 lines (38 loc) · 943 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "task_system.hpp"
class Task1 : public Task {
public:
Task1() : Task(1) {}
void run() override {
while (true) {
DEBUG_PRINT("Task 1 running");
toggle_pin(1);
TaskManager::yield();
local_var = function_x(10);
local_var += 1;
DEBUG_PRINT("Task 1 local_var: %u", local_var);
}
}
};
class Task2 : public Task {
public:
Task2() : Task(2) {}
void run() override {
while (true) {
DEBUG_PRINT("Task 2 running");
toggle_pin(2);
TaskManager::yield();
local_var = function_x(20);
local_var += 2;
DEBUG_PRINT("Task 2 local_var: %u", local_var);
}
}
};
Task1 task1;
Task2 task2;
int main() {
DEBUG_PRINT("Initializing tasks");
task_manager.add_task(&task1);
task_manager.add_task(&task2);
task_manager.start();
return 0;
}