Moved things to a FreeRTOS task so that we can garunte that we are meeting timings

This commit is contained in:
2026-08-08 21:31:54 -06:00
parent ea34c399d7
commit 3946e464c9
4 changed files with 106 additions and 7 deletions
+65
View File
@@ -0,0 +1,65 @@
#include "system_task.h"
SystemTask::SystemTask(ServiceManager& manager)
:
serviceManager(manager),
taskHandle(nullptr)
{
}
// xTaskCreatePinnedToCore(
// function,
// name,
// stack size,
// parameter,
// priority,
// handle,
// core
// );
void SystemTask::start()
{
xTaskCreatePinnedToCore(
taskEntry,
"SystemTask",
4096,
this,
2,
&taskHandle,
1
);
}
void SystemTask::taskEntry(void* parameter)
{
SystemTask* task =
static_cast<SystemTask*>(parameter);
task->run();
}
void SystemTask::run()
{
serviceManager.begin();
TickType_t lastWakeTime =
xTaskGetTickCount();
while(true)
{
serviceManager.update();
vTaskDelayUntil(
&lastWakeTime,
pdMS_TO_TICKS(10)
);
}
}