mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-06-10 16:45:59 +00:00
Merge pull request 'ReadMe changes' (#44) from fix/readme into main
Reviewed-on: https://git.intern.spaceteamaachen.de/ALPAKA/TACOS/pulls/44 Reviewed-by: carlwachter <carlwachter@noreply.git.intern.spaceteamaachen.de>
This commit is contained in:
commit
aa21c44270
18
README.md
18
README.md
@ -45,15 +45,18 @@ git submodule add https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
|
||||
```
|
||||
|
||||
Make sure that you add the include paths for TACOS, sta-core and rtos2-utils to the project with the following steps:
|
||||
1. `Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C -> Add...`
|
||||
1. Right click your project in the `Project Explorer` and select `Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C -> Add...`
|
||||
2. Select `Add to all languages` and `Is a workspace path`
|
||||
3. Click on `Workspace` and select a folder from the `YOUR_PROJECT_FOLDER/(Libs|App)` directory
|
||||
- Always select the `include` or `Inc` folder for the include paths
|
||||
- If the path you want to add is not in the list, refresh the project with `F5` in the `Project Explorer` and try again
|
||||
4. Repeat for TACOS, sta-core, rtos2-utils and the App folder
|
||||
5. `Properties -> C/C++ General -> Paths and Symbols -> Source Location -> Add Folder...`
|
||||
5. Right click your project in the `Project Explorer` and select `Properties -> C/C++ General -> Paths and Symbols -> Source Location -> Add Folder...`
|
||||
- Add the `App` and `Libs` folders
|
||||
|
||||
> [!NOTE]
|
||||
> You often want to add more submodules during development. Here, a faster way to add the include path for a library is to right click the library's include folder in the `Project Explorer` and select `Add/remove include path`.
|
||||
|
||||
### Starting TACOS
|
||||
|
||||
Navigate to the `Core/Src/freertos.c` file and add the following code to the `StartDefaultTask` function:
|
||||
@ -162,6 +165,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,11 +179,11 @@ 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.
|
||||
sta::tacos::addThread<tasks::SpamTask>(ALL_STATES - state_set{1,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_DEBUG_PRINTF("The answer to everything is %d", 42);
|
||||
}
|
||||
@ -185,6 +191,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