mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS-demo.git
synced 2025-09-28 15:57:33 +00:00
something 'It worked on my machine' something
This commit is contained in:
23
App/include/sta/config.hpp
Normal file
23
App/include/sta/config.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* config.hpp
|
||||
*
|
||||
* Created on: Dec 31, 2023
|
||||
* Author: Dario
|
||||
*/
|
||||
|
||||
#ifndef STA_CONFIG_HPP
|
||||
#define STA_CONFIG_HPP
|
||||
|
||||
#define STA_STM32_ASEAG
|
||||
#include <sta/devices/stm32/mcu/STM32F407xx.hpp>
|
||||
|
||||
// Enable debug serial output and assertions.
|
||||
#define STA_ASSERT_ENABLED
|
||||
#define STA_DEBUGGING_ENABLED
|
||||
|
||||
// Use the default configs for TACOS
|
||||
#include <sta/tacos/configs/default.hpp>
|
||||
|
||||
#define STA_TACOS_NUM_STATES 3
|
||||
|
||||
#endif // STA_CONFIG_HPP
|
20
App/include/tasks/spam_task.hpp
Normal file
20
App/include/tasks/spam_task.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef INC_TASKS_SPAM_TASK_HPP_
|
||||
#define INC_TASKS_SPAM_TASK_HPP_
|
||||
|
||||
#include <sta/tacos.hpp>
|
||||
|
||||
namespace tasks
|
||||
{
|
||||
class SpamTask : public sta::tacos::TacosThread {
|
||||
public:
|
||||
SpamTask();
|
||||
|
||||
// One time function that is called when the thread is created.
|
||||
void init() override;
|
||||
|
||||
// Repeatable function that is called every time the thread is executed.
|
||||
void func() override;
|
||||
};
|
||||
} // namespace tasks
|
||||
|
||||
#endif /* INC_TASKS_SPAM_TASK_HPP_ */
|
19
App/src/startup.cpp
Normal file
19
App/src/startup.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <sta/tacos.hpp>
|
||||
#include <tasks/spam_task.hpp>
|
||||
|
||||
#include <sta/debug/debug.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace tacos
|
||||
{
|
||||
void startup()
|
||||
{
|
||||
// ###### Register different threads for different states here. ######
|
||||
// Register a "Spam Task" thread for all states except 1 and 2.
|
||||
sta::tacos::addThread<tasks::SpamTask>(ALL_STATES - state_set{1,2});
|
||||
|
||||
STA_DEBUG_PRINTF("The answer to everything is %d", 42);
|
||||
}
|
||||
} // namespace tacos
|
||||
} // namespace sta
|
17
App/src/tasks/spam_task.cpp
Normal file
17
App/src/tasks/spam_task.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <tasks/spam_task.hpp>
|
||||
#include <sta/debug/debug.hpp>
|
||||
|
||||
namespace tasks {
|
||||
SpamTask::SpamTask() :
|
||||
TacosThread("SPAM", osPriorityNormal){}
|
||||
|
||||
void SpamTask::init() {
|
||||
// Nothing to init...
|
||||
}
|
||||
|
||||
void SpamTask::func() {
|
||||
// Print "Hello World" every second.
|
||||
STA_DEBUG_PRINTLN("Hello World");
|
||||
this->periodicDelay(1); // Execute this function with 1 Hz.
|
||||
}
|
||||
} // namespace tasks
|
Reference in New Issue
Block a user