-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskESP32.cpp
More file actions
52 lines (39 loc) · 835 Bytes
/
Copy pathTaskESP32.cpp
File metadata and controls
52 lines (39 loc) · 835 Bytes
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
43
44
45
46
47
48
49
50
51
52
#include "Arduino.h"
#include "TaskESP32.h"
void runTask(void *pvParameters);
Task::Task() {
}
void Task::start() {
// Cria tarefa FreeRTOS
xTaskCreatePinnedToCore(
runTask,
"Task",
_stackSize,
this,
_priority,
NULL,
ARDUINO_RUNNING_CORE
);
}
void Task::delay(unsigned long miliseconds) {
vTaskDelay(miliseconds);
}
void Task::setup() {
}
void Task::loop() {
}
void Task::setStackSize(int stackSize) {
_stackSize = stackSize;
}
void Task::setPriority(int priority) {
_priority = priority;
}
// Executa tarefa
void runTask(void *pvParameters)
{
Task *task = (Task *)pvParameters;
task->setup();
while (true) {
task->loop();
}
}