mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-06-10 16:45:59 +00:00
Added startup() as entry point and added warning for thread priorities
This commit is contained in:
parent
235dd0a6d7
commit
c652d23032
@ -162,6 +162,9 @@ namespace tasks {
|
||||
} // namespace tasks
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> A thread's priority must be strictly lower than the statemachine's priority. Unless manually changed, this is always `osPriorityHigh`.
|
||||
|
||||
To start this thread, we first need to fill out the `startup.cpp` file. This file may look like this:
|
||||
```cpp
|
||||
#include <sta/tacos.hpp>
|
||||
@ -173,7 +176,7 @@ namespace sta
|
||||
{
|
||||
namespace tacos
|
||||
{
|
||||
void onStatemachineInit()
|
||||
void startup()
|
||||
{
|
||||
// ###### Register different threads for different states here. ######
|
||||
// Register a "Spam Task" thread for all states except 1 and 2.
|
||||
@ -185,6 +188,8 @@ namespace sta
|
||||
} // namespace sta
|
||||
```
|
||||
|
||||
The function `startup()` is a weakly implemented function that is executed right before TACOS initializes its statemachine task. It serves as an entry point for the user to initialize all busses, threads and rtos2-utils stuff that is needed for the application to fulfill its purpose.
|
||||
|
||||
And that's it! Now you have a thread that prints "Hello World" every second. Simply build the project and flash it to your microcontroller and be amazed by the Spam!
|
||||
|
||||
### Setting up the CAN Bus
|
||||
|
Loading…
x
Reference in New Issue
Block a user