mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-06-13 17:55:59 +00:00
68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
/*
|
|
* manager.cpp
|
|
*
|
|
* Created on: Aug 30, 2023
|
|
* Author: Dario
|
|
*/
|
|
|
|
|
|
#include <cmsis_os2.h>
|
|
#include <FreeRTOS.h>
|
|
|
|
#include <sta/debug/debug.hpp>
|
|
#include <sta/debug/assert.hpp>
|
|
|
|
#include <sta/rtos/system/events.hpp>
|
|
|
|
typedef StaticTask_t osStaticThreadDef_t;
|
|
|
|
|
|
extern "C" void outputTask(void *);
|
|
|
|
|
|
void startWorker(void *arg)
|
|
{
|
|
STA_DEBUG_PRINTLN("STARTED WORKER!");
|
|
|
|
osThreadExit();
|
|
}
|
|
|
|
extern "C" void startManagerTask(void *)
|
|
{
|
|
STA_DEBUG_PRINTLN("INITIALIZED MANAGER TASK");
|
|
|
|
/*
|
|
// Create thread using static allocation
|
|
osThreadId_t outputTaskHandle;
|
|
uint32_t outputTaskBuffer[ 128 ];
|
|
osStaticThreadDef_t outputTaskControlBlock;
|
|
const osThreadAttr_t outputTask_attributes = {
|
|
.name = "outputTask",
|
|
.cb_mem = &outputTaskControlBlock,
|
|
.cb_size = sizeof(outputTaskControlBlock),
|
|
.stack_mem = &outputTaskBuffer[0],
|
|
.stack_size = sizeof(outputTaskBuffer),
|
|
.priority = (osPriority_t) osPriorityLow,
|
|
};
|
|
|
|
outputTaskHandle = osThreadNew(outputTask, NULL, &outputTask_attributes);
|
|
STA_ASSERT_MSG(outputTaskHandle != nullptr, "outputTask initialization failed");
|
|
*/
|
|
|
|
// Create thread using static allocation
|
|
const osThreadAttr_t workerAttributes = {};
|
|
|
|
for (uint8_t i = 0; i < 5; i++)
|
|
{
|
|
osThreadNew(startWorker, NULL, &workerAttributes);
|
|
}
|
|
|
|
while (true)
|
|
{
|
|
// STA_DEBUG_PRINTLN("MANAGING!");
|
|
}
|
|
|
|
osThreadExit();
|
|
}
|
|
|