Skip to content

Commit 0500055

Browse files
committed
Initial FreeRTOS tasks proposal
1 parent f7489bd commit 0500055

1 file changed

Lines changed: 118 additions & 10 deletions

File tree

src/main.cpp

Lines changed: 118 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,126 @@
1+
// This is a personal academic project. Dear PVS-Studio, please check it.
2+
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java:
3+
// https://pvs-studio.com
4+
5+
/* Includes */
6+
#include "2026Core/Net/Net-Link/AdapterUHCI.hpp"
7+
// #include "2026Core/Net/NetAdapter_A.hpp"
8+
#include "esp_log.h"
19
#include <Arduino.h>
210

3-
// put function declarations here:
4-
int myFunction(int, int);
11+
/* Config */
12+
static constexpr char *TAG = "LoMa";
13+
14+
/* Function Prototypes */
515

16+
/**
17+
* MARK: Setup
18+
* put your setup code here, to run once:
19+
*/
620
void setup() {
7-
// put your setup code here, to run once:
8-
int result = myFunction(2, 3);
21+
pinMode(LED::LED_PIN, OUTPUT);
22+
23+
// Set up tasks
24+
xTaskCreate(vTaskStatusLED, // Task function
25+
"Status LED", // Name of the task (for debugging)
26+
1024, // Stack size (in words, not bytes)
27+
nullptr, // Task input parameter
28+
1, // Priority of the task
29+
nullptr // Task handle
30+
);
31+
}
32+
33+
/**
34+
* MARK: Tasks
35+
* @see
36+
* https://www.freertos.org/Documentation/02-Kernel/02-Kernel-features/01-Tasks-and-co-routines/05-Implementing-a-task
37+
* @see https://forum.arduino.cc/t/non-blocking-delay-actions/1044079
38+
*/
39+
40+
void vTaskStatusLED(void *pvParameters) {
41+
while (true) {
42+
digitalWrite(LED::LED_PIN, HIGH);
43+
delay(LED::BLINK_ON_MILLIS);
44+
digitalWrite(LED::LED_PIN, LOW);
45+
delay(LED::BLINK_OFF_MILLIS);
46+
}
47+
}
48+
49+
/**
50+
* @brief Task to handle Telnet connections
51+
*/
52+
void vTaskTelnet(void *pvParameters) {
53+
while (true) {
54+
}
55+
}
56+
57+
/**
58+
* @brief Task to handle ElegantOTA connections
59+
* @deprecated Just use a USB cable if possible
60+
*/
61+
void vTaskOTA(void *pvParameters) {
62+
while (true) {
63+
}
64+
}
65+
66+
/**
67+
* @brief Task to poll high priority sensors
68+
*/
69+
void vTaskPollSensors(void *pvParameters) {
70+
while (true) {
71+
}
72+
}
73+
74+
/**
75+
* @brief Task to control run the FSM
76+
*/
77+
void vTaskUpdateFSM(void *pvParameters) {
78+
while (true) {
79+
}
80+
}
81+
82+
/**
83+
* @brief Task to control run the variable load
84+
*/
85+
void vTaskVarLoad(void *pvParameters) {
86+
while (true) {
87+
}
88+
}
89+
90+
/**
91+
* @brief Task to handle inbound data that has been queued
92+
*/
93+
void vTaskHandleInboundData(void *pvParameters) {
94+
while (true) {
95+
}
96+
}
97+
98+
/**
99+
* @brief Task to handle outbound data that has been queued
100+
*/
101+
void vTaskHandleOutboundData(void *pvParameters) {
102+
while (true) {
103+
}
104+
}
105+
106+
/**
107+
* @brief Task to log data
108+
*/
109+
void vTaskLogData(void *pvParameters) {
110+
while (true) {
111+
}
9112
}
10113

11-
void loop() {
12-
// put your main code here, to run repeatedly:
114+
/**
115+
* @brief Task to track idle time
116+
*/
117+
void vTaskIdle(void *pvParameters) {
118+
while (true) {
119+
}
13120
}
14121

15-
// put function definitions here:
16-
int myFunction(int x, int y) {
17-
return x + y;
18-
}
122+
/**
123+
* MARK: loop
124+
* Arduino: put your main code here, to run repeatedly:
125+
*/
126+
void loop() {}

0 commit comments

Comments
 (0)