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
11
README.md
11
README.md
@ -162,6 +162,9 @@ namespace tasks {
|
|||||||
} // 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:
|
To start this thread, we first need to fill out the `startup.cpp` file. This file may look like this:
|
||||||
```cpp
|
```cpp
|
||||||
#include <sta/tacos.hpp>
|
#include <sta/tacos.hpp>
|
||||||
@ -173,11 +176,11 @@ namespace sta
|
|||||||
{
|
{
|
||||||
namespace tacos
|
namespace tacos
|
||||||
{
|
{
|
||||||
void onStatemachineInit()
|
void startup()
|
||||||
{
|
{
|
||||||
// ###### Register different threads for different states here. ######
|
// ###### Register different threads for different states here. ######
|
||||||
// Register a "Spam Task" thread for all states except 1 and 2.
|
// Register a "Spam Task" thread for all states except 1 and 2.
|
||||||
sta::tacos::addThread<tasks::SpamTask>(ALL_STATES - state_set{1,2});
|
sta::tacos::addThread<tasks::SpamTask>(ALL_STATES - state_set{1,2});
|
||||||
|
|
||||||
STA_DEBUG_PRINTF("The answer to everything is %d", 42);
|
STA_DEBUG_PRINTF("The answer to everything is %d", 42);
|
||||||
}
|
}
|
||||||
@ -185,6 +188,8 @@ namespace sta
|
|||||||
} // 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!
|
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
|
### Setting up the CAN Bus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user