mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-02 16:51:53 +00:00
Added basic output Task
This commit is contained in:
parent
d8f592d455
commit
60e1d4c372
@ -7,14 +7,39 @@
|
||||
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
#include <FreeRTOS.h>
|
||||
|
||||
#include <sta/debug/debug.hpp>
|
||||
#include <sta/debug/assert.hpp>
|
||||
|
||||
typedef StaticTask_t osStaticThreadDef_t;
|
||||
|
||||
extern "C" void outputTask(void *);
|
||||
|
||||
namespace sta{
|
||||
|
||||
namespace rtos{
|
||||
|
||||
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");
|
||||
|
||||
while (true)
|
||||
{
|
||||
// TODO
|
||||
@ -22,5 +47,6 @@ extern "C" void startManagerTask(void *)
|
||||
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
23
App/Src/tasks/output.cpp
Normal file
23
App/Src/tasks/output.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* manager.cpp
|
||||
*
|
||||
* Created on: Aug 31, 2023
|
||||
* Author: Carl
|
||||
*/
|
||||
|
||||
#include <cmsis_os.h>
|
||||
#include <string>
|
||||
#include <usart.h>
|
||||
|
||||
|
||||
extern "C" void outputTask(void *)
|
||||
{
|
||||
std::string str("Hello World!");
|
||||
|
||||
for (char c : str)
|
||||
{
|
||||
HAL_UART_Transmit(&huart2, (uint8_t*)&c, 1, HAL_MAX_DELAY);
|
||||
}
|
||||
|
||||
osThreadExit();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user