sta-core/README.md
2022-04-24 13:42:34 +02:00

81 lines
2.0 KiB
Markdown

# STA Core library
Collection of useful stuff.
# Modules
## Assert
Assertion handling.
Configuration:
* `#define STA_ASSERT_ENABLE`: Enable module
* `#define STA_ASSERT_DISABLE`: Forces module off when defined
* `#define STA_HALT <func_name>`: Override function called after failed asserts
* `DEBUG`: Automatically enables module when defined
* `NDEBUG`: Forces module off when defined
Both `sta::assert_failed` and `sta::assert_halt` provide weak definitions and
can be overridden by the application. `sta::assert_halt` is only called
via the **STA_HALT** macro which can also be provided by the application.
The default implementation of `sta::assert_failed` uses **STA_DEBUG_PRINT** internally
and will not generate any output if the **DEBUG_SERIAL** module is disabled.
## Debug Serial
Debug serial output macros.
Configuration:
* `#define STA_DEBUG_SERIAL_ENABLE`: Enable module
* `#define STA_DEBUG_SERIAL_DISABLE`: Forces module off when defined
* `DEBUG`: Automatically enables module when defined
* `NDEBUG`: Forces module off when defined
The `sta::DebugSerial` instance must be provided.
## Endian
Endian-ness conversion for multi-byte types.
## Enum Flags
Type for using enum values as combinable flags.
## Lang
Macros related to compiler features. Not actually part of the C/C++ language.
## MCU
Defines specific to different MCUs. Include the appropriate header from `sta/mcu`
for the MCU used by the application in the `<sta/config.hpp>` header.
## Printf
Choose which `printf` implementation is used by STA libraries.
Configuration:
* `#define STA_PRINTF_USE_STDLIB`: Use the stdlib implementation
* `#define STA_PRINTF_USE_MPALAND`: Use the implementation by Marco Paland (thread safe & reentrant)
## HAL Delay
HAL based delay functions.
Configuration:
* `#define STA_HAL_DELAY_ENABLE`: Enable module
* `#define STA_HAL_DELAY_US_TIM <tim_handle>`: 1 MHz TIM instance used by `sta::delayUs`
TIM time base must be started before using `sta::delayUs` by calling `sta::initHAL`.
When using the startup system task this is handled automatically.