mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-02 16:51:53 +00:00
Added basic task creating in manager task
This commit is contained in:
parent
ac7237b0bb
commit
96e9213b1a
@ -25,5 +25,6 @@
|
|||||||
// Settings for the rtos-utils
|
// Settings for the rtos-utils
|
||||||
#define STA_RTOS_SYSTEM_EVENTS_ENABLE
|
#define STA_RTOS_SYSTEM_EVENTS_ENABLE
|
||||||
#define STA_RTOS_SYSTEM_WATCHDOG_ENABLE
|
#define STA_RTOS_SYSTEM_WATCHDOG_ENABLE
|
||||||
|
#define STA_RTOS_WATCHDOG_ENABLE
|
||||||
|
|
||||||
#endif /* INC_STA_CONFIG_HPP_ */
|
#endif /* INC_STA_CONFIG_HPP_ */
|
||||||
|
@ -16,8 +16,17 @@
|
|||||||
|
|
||||||
typedef StaticTask_t osStaticThreadDef_t;
|
typedef StaticTask_t osStaticThreadDef_t;
|
||||||
|
|
||||||
|
|
||||||
extern "C" void outputTask(void *);
|
extern "C" void outputTask(void *);
|
||||||
|
|
||||||
|
|
||||||
|
void startWorker(void *arg)
|
||||||
|
{
|
||||||
|
STA_DEBUG_PRINTLN("STARTED WORKER!");
|
||||||
|
|
||||||
|
osThreadExit();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void startManagerTask(void *)
|
extern "C" void startManagerTask(void *)
|
||||||
{
|
{
|
||||||
STA_DEBUG_PRINTLN("INITIALIZED MANAGER TASK");
|
STA_DEBUG_PRINTLN("INITIALIZED MANAGER TASK");
|
||||||
@ -40,9 +49,17 @@ extern "C" void startManagerTask(void *)
|
|||||||
STA_ASSERT_MSG(outputTaskHandle != nullptr, "outputTask initialization failed");
|
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)
|
while (true)
|
||||||
{
|
{
|
||||||
STA_DEBUG_PRINTLN("PING!");
|
// STA_DEBUG_PRINTLN("MANAGING!");
|
||||||
}
|
}
|
||||||
|
|
||||||
osThreadExit();
|
osThreadExit();
|
||||||
|
@ -9,14 +9,16 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <usart.h>
|
#include <usart.h>
|
||||||
|
|
||||||
|
#include <sta/debug/debug.hpp>
|
||||||
|
|
||||||
|
|
||||||
extern "C" void outputTask(void *)
|
extern "C" void outputTask(void *)
|
||||||
{
|
{
|
||||||
std::string str("Hello World!");
|
while (true)
|
||||||
|
|
||||||
for (char c : str)
|
|
||||||
{
|
{
|
||||||
HAL_UART_Transmit(&huart2, (uint8_t*)&c, 1, HAL_MAX_DELAY);
|
STA_DEBUG_PRINTLN("OUTPUT TASK RUNNING");
|
||||||
|
|
||||||
|
osThreadYield();
|
||||||
}
|
}
|
||||||
|
|
||||||
osThreadExit();
|
osThreadExit();
|
||||||
|
24
App/Src/tasks/watchdog.cpp
Normal file
24
App/Src/tasks/watchdog.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* watchdog.cpp
|
||||||
|
*
|
||||||
|
* Created on: Sep 1, 2023
|
||||||
|
* Author: Dario
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sta/debug/debug.hpp>
|
||||||
|
#include <sta/rtos/system/watchdog.hpp>
|
||||||
|
|
||||||
|
namespace sta
|
||||||
|
{
|
||||||
|
namespace rtos
|
||||||
|
{
|
||||||
|
// Implementation of the watchdog event handler.
|
||||||
|
void watchdogEventHandler(void *, uint32_t flags)
|
||||||
|
{
|
||||||
|
if (flags & STA_WATCHDOG_FLAG_HEARTBEAT)
|
||||||
|
{
|
||||||
|
STA_DEBUG_PRINTLN("PING!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace sta
|
Loading…
x
Reference in New Issue
Block a user