mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-02 08:41:54 +00:00
Merge pull request 'startup-update' (#17) from startup-update into main
Reviewed-on: https://git.intern.spaceteamaachen.de/ALPAKA/TACOS/pulls/17 Reviewed-by: carlwachter <carlwachter@noreply.git.intern.spaceteamaachen.de>
This commit is contained in:
commit
3401235717
34
README.md
34
README.md
@ -28,26 +28,8 @@ void StartDefaultTask(void *argument)
|
||||
}
|
||||
```
|
||||
|
||||
Ebenfalls müssen noch diese Ergänzungen in `Core/Src/freertos.c` vorgenommen werden:
|
||||
```
|
||||
/* Definitions for uartMutex */
|
||||
osMutexId_t uartMutexHandle;
|
||||
osStaticMutexDef_t uartMutex_cb;
|
||||
const osMutexAttr_t uartMutex_attributes = {
|
||||
.name = "uartMutex",
|
||||
.cb_mem = &uartMutex_cb,
|
||||
.cb_size = sizeof(uartMutex_cb),
|
||||
};
|
||||
|
||||
|
||||
void MX_FREERTOS_Init(void) {
|
||||
uartMutexHandle = osMutexNew(&uartMutex_attributes);
|
||||
//...
|
||||
}
|
||||
```
|
||||
|
||||
## Configuring TACOS
|
||||
Be sure to add a "config.hpp" to the App/Inc/sta directory. This file could look like this:
|
||||
In order to use TACOS, you need to provide a configuration file in the path `sta/config.hpp`. The following code is an example for a TACOS-project using default configuration:
|
||||
```
|
||||
#ifndef INC_STA_CONFIG_HPP_
|
||||
#define INC_STA_CONFIG_HPP_
|
||||
@ -62,23 +44,13 @@ Be sure to add a "config.hpp" to the App/Inc/sta directory. This file could look
|
||||
#define STA_ASSERT_FORCE
|
||||
#define STA_DEBUGGING_ENABLED
|
||||
|
||||
// Activate the timer for microsecond delays.
|
||||
// #define STA_STM32_DELAY_ENABLE
|
||||
// #define STA_STM32_DELAY_US_TIM htim1
|
||||
|
||||
// Settings for the rtos-utils
|
||||
#define STA_RTOS_SYSTEM_EVENTS_ENABLE
|
||||
// #define STA_RTOS_SYSTEM_WATCHDOG_ENABLE
|
||||
// #define STA_RTOS_WATCHDOG_ENABLE
|
||||
|
||||
|
||||
// Settings for TACOS
|
||||
#define STA_TACOS_MANAGER_PRIORITY osPriorityNormal
|
||||
#define STA_TACOS_STATEMACHINE_PRIORITY osPriorityNormal
|
||||
|
||||
// Statemachine settings. Here, we only have a single state which is also the initial state.
|
||||
#define STA_TACOS_NUM_STATES 3
|
||||
#define STA_TACOS_INITIAL_STATE 0
|
||||
// Uses the default configuration for TACOS.
|
||||
#include<sta/tacos/configs/default.hpp>
|
||||
|
||||
#endif /* INC_STA_CONFIG_HPP_ */
|
||||
```
|
||||
|
12
include/sta/tacos/configs/default.hpp
Normal file
12
include/sta/tacos/configs/default.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef STA_TACOS_CONFIGS_DEFAULT_HPP
|
||||
#define STA_TACOS_CONFIGS_DEFAULT_HPP
|
||||
|
||||
// Generally, we assume the TACOS threads to have the highest priorties.
|
||||
#define STA_TACOS_MANAGER_PRIORITY osPriorityHigh
|
||||
#define STA_TACOS_STATEMACHINE_PRIORITY osPriorityHigh
|
||||
#define STA_TACOS_WATCHDOG_PRIORITY osPriorityHigh
|
||||
|
||||
// Per default, we assume state 0 to be the initial state.
|
||||
#define STA_TACOS_INITIAL_STATE 0
|
||||
|
||||
#endif // STA_TACOS_CONFIGS_DEFAULT_HPP
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* startup.hpp
|
||||
*
|
||||
* Created on: 22 Sep 2023
|
||||
* Author: Dario
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_STA_TACOS_STARTUP_HPP_
|
||||
#define INCLUDE_STA_TACOS_STARTUP_HPP_
|
||||
|
||||
/**
|
||||
* @defgroup tacos TACOS
|
||||
* @brief TACOS library.
|
||||
*/
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace tacos
|
||||
{
|
||||
/**
|
||||
* @brief Function that is called before the statemachine task is started.
|
||||
* Override it to adjust the statemachine to your specifications.
|
||||
*/
|
||||
void onStatemachineInit();
|
||||
|
||||
/**
|
||||
* @brief Function that is called before the manager task is started.
|
||||
* Override it to adjust the manager to your specifications.
|
||||
*/
|
||||
void onManagerInit();
|
||||
} // namespace tacos
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDE_STA_TACOS_STARTUP_HPP_ */
|
@ -5,6 +5,13 @@
|
||||
* Author: Dario
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup tacos
|
||||
* @brief TACOS library.
|
||||
*/
|
||||
|
||||
|
||||
#include <sta/config.hpp>
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
#include <usart.h>
|
||||
@ -19,7 +26,6 @@
|
||||
// Tacos-specific includes.
|
||||
#include <sta/tacos/manager.hpp>
|
||||
#include <sta/tacos/statemachine.hpp>
|
||||
#include <sta/tacos/startup.hpp>
|
||||
|
||||
|
||||
// The UART mutex defined in freertos.c
|
||||
@ -28,6 +34,7 @@ extern osMutexId_t uartMutexHandle;
|
||||
|
||||
namespace sta
|
||||
{
|
||||
#ifdef STA_DEBUGGING_ENABLED
|
||||
// Here the printable used for debugging is defined.
|
||||
Printable * Debug;
|
||||
|
||||
@ -36,7 +43,7 @@ namespace sta
|
||||
void initPrintable()
|
||||
{
|
||||
// Initialize the mutex for UART communication.
|
||||
RtosMutex * mutex = new RtosMutex(&uartMutexHandle);
|
||||
RtosMutex * mutex = new RtosMutex("uart");
|
||||
|
||||
// Initialize the UART interface and printable object.
|
||||
UARTSettings settings = { .mode = UARTMode::RX_TX };
|
||||
@ -45,13 +52,19 @@ namespace sta
|
||||
|
||||
STA_DEBUG_PRINTLN("UART SUCCESSFULLY INITIALIZED");
|
||||
}
|
||||
}
|
||||
#endif // STA_DEBUGGING_ENABLED
|
||||
|
||||
|
||||
namespace tacos
|
||||
{
|
||||
/**
|
||||
* @brief Function that is called before the statemachine task is started. Override it to
|
||||
* adjust the statemachine to your specifications.
|
||||
*/
|
||||
STA_WEAK
|
||||
void onStatemachineInit()
|
||||
{}
|
||||
|
||||
|
||||
void initStatemachine()
|
||||
{
|
||||
onStatemachineInit();
|
||||
@ -59,12 +72,14 @@ namespace sta
|
||||
Statemachine::instance()->start();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Function that is called before the manager task is started. Override it to adjust
|
||||
* the manager to your specifications.
|
||||
*/
|
||||
STA_WEAK
|
||||
void onManagerInit()
|
||||
{}
|
||||
|
||||
|
||||
void initManager()
|
||||
{
|
||||
onManagerInit();
|
||||
@ -79,7 +94,9 @@ namespace sta
|
||||
// Override the weak implementation of startupExtras provided in rtos2-utils.
|
||||
void startupExtras(void * argument)
|
||||
{
|
||||
#ifdef STA_DEBUGGING_ENABLED
|
||||
tacos::initPrintable();
|
||||
#endif // STA_DEBUGGING_ENABLED
|
||||
|
||||
tacos::initStatemachine();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user