diff --git a/README.md b/README.md index d28f2d1..33243a4 100644 --- a/README.md +++ b/README.md @@ -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 @@ -173,11 +176,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(ALL_STATES - state_set{1,2}); + // Register a "Spam Task" thread for all states except 1 and 2. + sta::tacos::addThread(ALL_STATES - state_set{1,2}); STA_DEBUG_PRINTF("The answer to everything is %d", 42); } @@ -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