mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Fix indentation. Update doxygen comments
This commit is contained in:
parent
fc4eed38d5
commit
59585b2ae5
12
include/sta/arduino/not_implemented.hpp
Normal file
12
include/sta/arduino/not_implemented.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef STA_CORE_ARDUINO_NOT_IMPLEMENTED_HPP
|
||||
#define STA_CORE_ARDUINO_NOT_IMPLEMENTED_HPP
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_arduino Arduino
|
||||
* @ingroup sta_core_platforms
|
||||
* @brief Modules implemented for the Arduino platform.
|
||||
*/
|
||||
|
||||
|
||||
#endif // STA_CORE_ARDUINO_NOT_IMPLEMENTED_HPP
|
@ -11,20 +11,14 @@
|
||||
#define STA_CORE_ASSERT_HPP
|
||||
|
||||
/**
|
||||
* @defgroup staCore Core
|
||||
* @defgroup sta_core Core
|
||||
* @brief STA Core library
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup staCoreBuildConfig Build Config
|
||||
* @ingroup staCore
|
||||
* @brief Build configuration options
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup staCoreAssert Assert
|
||||
* @ingroup staCore
|
||||
* @brief Assertion handling.
|
||||
* @defgroup sta_core_platforms Platforms
|
||||
* @ingroup sta_core
|
||||
* @brief Platform specific implementations.
|
||||
*/
|
||||
|
||||
|
||||
@ -49,8 +43,21 @@
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_assert Assert
|
||||
* @ingroup sta_core
|
||||
* @brief Assertion handling.
|
||||
*/
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @ingroup sta_core_assert
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Handle failed assertions.
|
||||
*
|
||||
@ -62,8 +69,6 @@ namespace sta
|
||||
* @param expr Asserted expression or message
|
||||
* @param file File name
|
||||
* @param line Line number
|
||||
*
|
||||
* @ingroup staCoreAssert
|
||||
*/
|
||||
void assert_failed(const char * expr, const char * file, uint32_t line);
|
||||
|
||||
@ -71,48 +76,38 @@ namespace sta
|
||||
* @brief Stop execution.
|
||||
*
|
||||
* Weak implementation can be overridden.
|
||||
*
|
||||
* @ingroup staCoreAssert
|
||||
*/
|
||||
void assert_halt();
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
|
||||
/**
|
||||
* @def STA_HALT
|
||||
* @brief Set function called after failed asserts.
|
||||
*
|
||||
* @ingroup staCoreBuildConfig
|
||||
* @ingroup sta_core_assert
|
||||
* @{
|
||||
*/
|
||||
# ifndef STA_HALT
|
||||
# define STA_HALT() sta::assert_halt()
|
||||
# endif // !STA_HALT
|
||||
|
||||
|
||||
/**
|
||||
* @brief Assert expression.
|
||||
*
|
||||
* @param expr Expression
|
||||
*
|
||||
* @ingroup staCoreAssert
|
||||
*/
|
||||
# define STA_ASSERT(expr) ( (void)( !(expr) && ( sta::assert_failed(#expr, __FILE__, __LINE__), 1 ) && ( STA_HALT(), 1 ) ) )
|
||||
# define STA_ASSERT(expr) ( (void)( !(expr) && ( sta::assert_failed(#expr, __FILE__, __LINE__), 1 ) && ( sta::assert_halt(), 1 ) ) )
|
||||
/**
|
||||
* @brief Assert expression.
|
||||
*
|
||||
* @param expr Expression
|
||||
* @param msg Message shown on failure
|
||||
*
|
||||
* @ingroup staCoreAssert
|
||||
*/
|
||||
# define STA_ASSERT_MSG(expr, msg) ( (void)( !(expr) && ( sta::assert_failed(msg, __FILE__, __LINE__), 1 ) && ( STA_HALT(), 1 ) ) )
|
||||
# define STA_ASSERT_MSG(expr, msg) ( (void)( !(expr) && ( sta::assert_failed(msg, __FILE__, __LINE__), 1 ) && ( sta::assert_halt(), 1 ) ) )
|
||||
/**
|
||||
* @brief Assert expression if condition is true.
|
||||
*
|
||||
* @param cond Condition
|
||||
* @param expr Expression
|
||||
*
|
||||
* @ingroup staCoreAssert
|
||||
*/
|
||||
# define STA_ASSERT_COND(cond, expr) ( (void)( (cond) ? STA_ASSERT(expr) : 1 ) )
|
||||
/**
|
||||
@ -121,13 +116,17 @@ namespace sta
|
||||
* @param cond Condition
|
||||
* @param expr Expression
|
||||
* @param msg Message shown on failure
|
||||
*
|
||||
* @ingroup staCoreAssert
|
||||
*/
|
||||
# define STA_ASSERT_COND_MSG(cond, expr, msg) ( (void)( (cond) ? STA_ASSERT_MSG(expr, msg) ) )
|
||||
/**
|
||||
* @brief Expression only evaluated when assertions are enabled.
|
||||
*
|
||||
* @param expr Expression
|
||||
*/
|
||||
# define STA_ASSERT_EXTRA(expr) expr
|
||||
|
||||
|
||||
# define STA_ASSERT_EXTRA(expr) expr;
|
||||
/** @} */
|
||||
|
||||
#else // !STA_ASSERT_ENABLED
|
||||
|
||||
|
@ -8,11 +8,13 @@
|
||||
#ifndef STA_CORE_ATOMIC_MUTEX_HPP
|
||||
#define STA_CORE_ATOMIC_MUTEX_HPP
|
||||
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STDLIB_HAS_ATOMIC
|
||||
# define STA_ATOMIC_ENABLED
|
||||
#endif // STA_STDLIB_HAS_ATOMIC
|
||||
|
||||
|
||||
#if defined(STA_ATOMIC_ENABLED) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/mutex.hpp>
|
||||
|
@ -8,11 +8,13 @@
|
||||
#ifndef STA_CORE_ATOMIC_SIGNAL_HPP
|
||||
#define STA_CORE_ATOMIC_SIGNAL_HPP
|
||||
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_STDLIB_HAS_ATOMIC
|
||||
# define STA_ATOMIC_ENABLED
|
||||
#endif // STA_STDLIB_HAS_ATOMIC
|
||||
|
||||
|
||||
#if defined(STA_ATOMIC_ENABLED) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/signal.hpp>
|
||||
|
@ -6,16 +6,11 @@
|
||||
#define STA_CORE_CAN_CONTROLLER_HPP
|
||||
|
||||
/**
|
||||
* @defgroup can CAN
|
||||
* @defgroup sta_core_can CAN
|
||||
* @ingroup sta_core
|
||||
* @brief CAN controller driver interface.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup canAPI API
|
||||
* @ingroup can
|
||||
* @brief Public interface.
|
||||
*/
|
||||
|
||||
|
||||
#include <sta/can/filter.hpp>
|
||||
#include <sta/can/headers.hpp>
|
||||
@ -27,7 +22,7 @@ namespace sta
|
||||
/**
|
||||
* @brief CAN controller driver interface.
|
||||
*
|
||||
* @ingroup canAPI
|
||||
* @ingroup sta_core_can
|
||||
*/
|
||||
class CanController
|
||||
{
|
||||
|
@ -13,16 +13,15 @@
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @defgroup canFilter Filters
|
||||
* @ingroup canAPI
|
||||
* @defgroup sta_core_can_filters Filters
|
||||
* @ingroup sta_core_can
|
||||
* @brief CAN message filter types.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief ID format matched by CAN filter.
|
||||
*
|
||||
* @ingroup canFilter
|
||||
*/
|
||||
enum class CanFilterIdFormat
|
||||
{
|
||||
@ -33,8 +32,6 @@ namespace sta
|
||||
|
||||
/**
|
||||
* @brief CAN filter settings.
|
||||
*
|
||||
* @ingroup canFilter
|
||||
*/
|
||||
struct CanFilter
|
||||
{
|
||||
@ -43,6 +40,9 @@ namespace sta
|
||||
CanFilterIdFormat type; /**< ID format to match */
|
||||
uint8_t fifo; /**< FIFO to store matches */
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
@ -13,16 +13,15 @@
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @defgroup canHeader Frame headers
|
||||
* @ingroup canAPI
|
||||
* @defgroup sta_core_can_headers Frame headers
|
||||
* @ingroup sta_core_can
|
||||
* @brief CAN header types for transmitted / received frames.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief CAN TX frame header.
|
||||
*
|
||||
* @ingroup canHeader
|
||||
*/
|
||||
struct CanTxHeader
|
||||
{
|
||||
@ -32,8 +31,6 @@ namespace sta
|
||||
|
||||
/**
|
||||
* @brief CAN RX frame header.
|
||||
*
|
||||
* @ingroup canHeader
|
||||
*/
|
||||
struct CanRxHeader
|
||||
{
|
||||
@ -42,6 +39,9 @@ namespace sta
|
||||
uint32_t timestamp; /**< RX timestamp */
|
||||
uint8_t filter; /**< RX filter match */
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @defgroup canID Frame IDs
|
||||
* @ingroup canAPI
|
||||
* @defgroup sta_core_can_ids Frame IDs
|
||||
* @ingroup sta_core_can
|
||||
* @brief Types for working with CAN ID values and formats.
|
||||
*/
|
||||
|
||||
@ -20,7 +20,7 @@ namespace sta
|
||||
/**
|
||||
* @brief CAN frame ID format.
|
||||
*
|
||||
* @ingroup canID
|
||||
* @ingroup sta_core_can_ids
|
||||
*/
|
||||
enum class CanIdFormat : uint8_t
|
||||
{
|
||||
@ -32,7 +32,7 @@ namespace sta
|
||||
/**
|
||||
* @brief CAN frame ID.
|
||||
*
|
||||
* @ingroup canID
|
||||
* @ingroup sta_core_can_ids
|
||||
*/
|
||||
struct CanId
|
||||
{
|
||||
@ -44,7 +44,7 @@ namespace sta
|
||||
/**
|
||||
* @brief CAN frame ID and format.
|
||||
*
|
||||
* @ingroup canID
|
||||
* @ingroup sta_core_can_ids
|
||||
*/
|
||||
struct CanFrameId
|
||||
{
|
||||
@ -63,8 +63,6 @@ namespace sta
|
||||
* @param lhs Left hand side CAN ID
|
||||
* @param rhs Right hand side CAN ID
|
||||
* @return True if CAN IDs are equal
|
||||
*
|
||||
* @ingroup canID
|
||||
*/
|
||||
bool operator ==(const CanId & lhs, const CanId & rhs);
|
||||
/**
|
||||
@ -73,8 +71,6 @@ namespace sta
|
||||
* @param lhs Left hand side CAN ID
|
||||
* @param rhs Right hand side CAN ID
|
||||
* @return True if CAN IDs are not equal
|
||||
*
|
||||
* @ingroup canID
|
||||
*/
|
||||
bool operator !=(const CanId & lhs, const CanId & rhs);
|
||||
|
||||
@ -84,8 +80,6 @@ namespace sta
|
||||
* @param lhs Left hand side CAN Frame ID
|
||||
* @param rhs Right hand side CAN Frame ID
|
||||
* @return True if CAN Frame IDs are equal
|
||||
*
|
||||
* @ingroup canID
|
||||
*/
|
||||
bool operator ==(const CanFrameId & lhs, const CanFrameId & rhs);
|
||||
/**
|
||||
@ -94,8 +88,6 @@ namespace sta
|
||||
* @param lhs Left hand side CAN Frame ID
|
||||
* @param rhs Right hand side CAN Frame ID
|
||||
* @return True if CAN Frame IDs are not equal
|
||||
*
|
||||
* @ingroup canID
|
||||
*/
|
||||
bool operator !=(const CanFrameId & lhs, const CanFrameId & rhs);
|
||||
} // namespace sta
|
||||
@ -104,13 +96,13 @@ namespace sta
|
||||
/**
|
||||
* @brief Maximum CAN standard ID value.
|
||||
*
|
||||
* @ingroup canID
|
||||
* @ingroup sta_core_can_ids
|
||||
*/
|
||||
#define CAN_SID_MAX UINT32_C(0x7FF)
|
||||
/**
|
||||
* @brief Maximum CAN extended ID value.
|
||||
*
|
||||
* @ingroup canID
|
||||
* @ingroup sta_core_can_ids
|
||||
*/
|
||||
#define CAN_EID_MAX UINT32_C(0x3FFFF)
|
||||
|
||||
|
@ -10,6 +10,11 @@
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Iterable container interface for CAN RX flags.
|
||||
*
|
||||
* @ingroup sta_core_can_ids
|
||||
*/
|
||||
class CanPendingRxFifos
|
||||
{
|
||||
public:
|
||||
@ -18,6 +23,9 @@ namespace sta
|
||||
using const_reference = const value_type &;
|
||||
using size_type = uint8_t;
|
||||
|
||||
/**
|
||||
* @brief Custom iterator for active RX queues.
|
||||
*/
|
||||
class const_iterator
|
||||
{
|
||||
public:
|
||||
@ -41,25 +49,32 @@ namespace sta
|
||||
private:
|
||||
const_iterator(uint32_t rxFlags, uint8_t idx, uint8_t endIdx);
|
||||
|
||||
/**
|
||||
* @brief Check if current RX queue has pending data.
|
||||
*/
|
||||
bool isRxPending() const;
|
||||
|
||||
friend class CanPendingRxFifos;
|
||||
|
||||
private:
|
||||
uint32_t rxFlags_;
|
||||
uint8_t idx_;
|
||||
uint8_t endIdx_;
|
||||
uint32_t rxFlags_; /**< RX flag bits */
|
||||
uint8_t idx_; /**< Current flag index */
|
||||
uint8_t endIdx_; /**< Iterator end index */
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param rxFlags RX flag bits
|
||||
* @param numFifos Number of RX FIFOs
|
||||
*/
|
||||
CanPendingRxFifos(uint32_t rxFlags, uint8_t numFifos);
|
||||
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
private:
|
||||
uint32_t rxFlags_;
|
||||
uint8_t numFifos_;
|
||||
uint32_t rxFlags_; /**< RX flag bits */
|
||||
uint8_t numFifos_; /**< Number of RX FIFOs */
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
@ -12,9 +12,10 @@
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @defgroup canSub Subscription
|
||||
* @ingroup canAPI
|
||||
* @defgroup sta_core_can_sub Subscription
|
||||
* @ingroup sta_core_can
|
||||
* @brief Subscription interface for CAN controller drivers.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
@ -23,16 +24,12 @@ namespace sta
|
||||
*
|
||||
* @param header Frame header
|
||||
* @param buffer Frame payload buffer
|
||||
*
|
||||
* @ingroup canSub
|
||||
*/
|
||||
using CanRxCallback = void (*) (const CanRxHeader & header, const uint8_t * buffer);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Filter configuration and message handler.
|
||||
*
|
||||
* @ingroup canSub
|
||||
*/
|
||||
struct CanFilterConfig
|
||||
{
|
||||
@ -45,8 +42,6 @@ namespace sta
|
||||
* @brief CAN controller with subscriptions.
|
||||
*
|
||||
* @tparam T Implementation of CanController interface
|
||||
*
|
||||
* @ingroup canSub
|
||||
*/
|
||||
template <typename T>
|
||||
class SubscribableCanController : public T
|
||||
@ -95,6 +90,9 @@ namespace sta
|
||||
private:
|
||||
CanRxCallback filterCallbacks_[T::MAX_FILTER_COUNT]; /**< Callbacks for RX filters */
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
@ -11,11 +11,6 @@
|
||||
#ifndef STA_CORE_DEBUG_SERIAL_HPP
|
||||
#define STA_CORE_DEBUG_SERIAL_HPP
|
||||
|
||||
/**
|
||||
* @defgroup staCoreDebug Debug Serial
|
||||
* @ingroup staCore
|
||||
* @brief Debug serial output.
|
||||
*/
|
||||
|
||||
#include <sta/config.hpp>
|
||||
|
||||
@ -35,17 +30,25 @@
|
||||
# endif // !STA_DEBUG_SERIAL_FORCE
|
||||
#endif // STA_DEBUG_SERIAL_UART
|
||||
|
||||
|
||||
#if defined(STA_DEBUG_SERIAL_ENABLED) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/printable_uart.hpp>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_debug Debug Serial
|
||||
* @ingroup sta_core
|
||||
* @brief Debug serial output.
|
||||
*/
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief %UART print object for debug serial output.
|
||||
*
|
||||
* @ingroup staCoreDebug
|
||||
* @ingroup sta_core_debug
|
||||
*/
|
||||
extern PrintableUART DebugSerial;
|
||||
} // namespace sta
|
||||
@ -56,7 +59,7 @@ namespace sta
|
||||
*
|
||||
* @param ... See @ref sta::PrintableUART::print
|
||||
*
|
||||
* @ingroup staCoreDebug
|
||||
* @ingroup sta_core_debug
|
||||
*/
|
||||
# define STA_DEBUG_PRINT(...) sta::DebugSerial.print(__VA_ARGS__)
|
||||
/**
|
||||
@ -64,7 +67,7 @@ namespace sta
|
||||
*
|
||||
* @param ... See @ref sta::PrintableUART::println
|
||||
*
|
||||
* @ingroup staCoreDebug
|
||||
* @ingroup sta_core_debug
|
||||
*/
|
||||
# define STA_DEBUG_PRINTLN(...) sta::DebugSerial.println(__VA_ARGS__)
|
||||
#else // !STA_DEBUG_SERIAL_ENABLED
|
||||
|
@ -5,11 +5,6 @@
|
||||
#ifndef STA_CORE_ENDIAN_HPP
|
||||
#define STA_CORE_ENDIAN_HPP
|
||||
|
||||
/**
|
||||
* @defgroup staCoreEndian Endian
|
||||
* @ingroup staCore
|
||||
* @brief Endian handling.
|
||||
*/
|
||||
|
||||
#include <sta/config.hpp>
|
||||
|
||||
@ -18,13 +13,19 @@
|
||||
#endif // !STA_MCU_BIG_ENDIAN && !STA_MCU_LITTLE_ENDIAN
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_endian Endian
|
||||
* @ingroup sta_core
|
||||
* @brief Endian handling.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get 16-bit value with swapped byte order.
|
||||
*
|
||||
* @param u16 16-bit input value
|
||||
* @return 16-bit value w/ swapped byte order
|
||||
*
|
||||
* @ingroup staCoreEndian
|
||||
*/
|
||||
#define STA_UINT16_SWAP_BYTE_ORDER(u16) \
|
||||
( \
|
||||
@ -37,8 +38,6 @@
|
||||
*
|
||||
* @param u32 32-bit input value
|
||||
* @return 32-bit value w/ swapped byte order
|
||||
*
|
||||
* @ingroup staCoreEndian
|
||||
*/
|
||||
#define STA_UINT32_SWAP_BYTE_ORDER(u32) \
|
||||
( \
|
||||
@ -53,8 +52,6 @@
|
||||
*
|
||||
* @param u16 16-bit input value
|
||||
* @return Initializer list for uint8_t[2]
|
||||
*
|
||||
* @ingroup staCoreEndian
|
||||
*/
|
||||
#define STA_UINT16_TO_BYTES_BE(u16) \
|
||||
{ \
|
||||
@ -67,8 +64,6 @@
|
||||
*
|
||||
* @param u16 16-bit input value
|
||||
* @return Initializer list for uint8_t[2]
|
||||
*
|
||||
* @ingroup staCoreEndian
|
||||
*/
|
||||
#define STA_UINT16_TO_BYTES_LE(u16) \
|
||||
{ \
|
||||
@ -81,8 +76,6 @@
|
||||
*
|
||||
* @param u32 32-bit input value
|
||||
* @return Initializer list for uint8_t[4]
|
||||
*
|
||||
* @ingroup staCoreEndian
|
||||
*/
|
||||
#define STA_UINT32_TO_BYTES_BE(u32) \
|
||||
{ \
|
||||
@ -97,8 +90,6 @@
|
||||
*
|
||||
* @param u32 32-bit input value
|
||||
* @return Initializer list for uint8_t[4]
|
||||
*
|
||||
* @ingroup staCoreEndian
|
||||
*/
|
||||
#define STA_UINT32_TO_BYTES_LE(u32) \
|
||||
{ \
|
||||
@ -110,7 +101,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* @defe STA_UINT16_TO_BE(u16)
|
||||
* @def STA_UINT16_TO_BE(u16)
|
||||
* @brief Convert 16-bit value to big-endian byte order.
|
||||
*
|
||||
* @param u16 16-bit input value
|
||||
@ -174,6 +165,9 @@
|
||||
*/
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#ifdef STA_MCU_LITTLE_ENDIAN
|
||||
|
||||
# define STA_UINT16_TO_BE(u16) STA_UINT16_SWAP_BYTE_ORDER(u16)
|
||||
@ -186,7 +180,7 @@
|
||||
# define STA_UINT32_TO_BYTES(u32) STA_UINT32_TO_BYTES_LE(u32)
|
||||
# define STA_UINT32_TO_BYTES_SWAP(u32) STA_UINT32_TO_BYTES_BE(u32)
|
||||
|
||||
#elif STA_MCU_BIG_ENDIAN
|
||||
#else // STA_MCU_BIG_ENDIAN
|
||||
|
||||
# define STA_UINT16_TO_BE(u16) (u16)
|
||||
# define STA_UINT16_TO_LE(u16) STA_UINT16_SWAP_BYTE_ORDER(u16)
|
||||
|
@ -15,7 +15,7 @@ namespace sta
|
||||
*
|
||||
* @tparam F Enum type used for flag bits
|
||||
*
|
||||
* @ingroup staCore
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
template <typename F>
|
||||
class EnumFlags
|
||||
@ -155,7 +155,7 @@ namespace sta
|
||||
*
|
||||
* @param enumType Enum type to overload
|
||||
*
|
||||
* @ingroup staCore
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
#define STA_ENUM_FLAGS_OVERLOAD(enumType) \
|
||||
sta::EnumFlags<enumType> operator |(enumType lhs, enumType rhs) \
|
||||
@ -168,7 +168,7 @@ namespace sta
|
||||
*
|
||||
* @param enumType Enum type for specialization
|
||||
*
|
||||
* @ingroup staCore
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
#define STA_ENUM_FLAGS_ALIAS(enumType) \
|
||||
using enumType ## Flags = sta::EnumFlags<enumType>
|
||||
@ -180,7 +180,7 @@ namespace sta
|
||||
* @param value1 First enum value
|
||||
* @param ... Enum values 2 - 32
|
||||
*
|
||||
* @ingroup staCore
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
#define STA_ENUM_FLAGS_DECL(enumType, value1, ...) \
|
||||
enum class enumType \
|
||||
|
@ -14,7 +14,7 @@ namespace sta
|
||||
* @tparam Size Size type
|
||||
* @tparam N Buffer size
|
||||
*
|
||||
* @ingroup staCore
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
template <typename Size, Size N>
|
||||
class FifoBuffer
|
||||
|
@ -8,6 +8,14 @@
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @defgroup sta_core_gpio GPIO
|
||||
* @ingroup sta_core
|
||||
* @brief GPIO pins.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief GPIO pin state.
|
||||
*/
|
||||
@ -30,6 +38,9 @@ namespace sta
|
||||
*/
|
||||
virtual void setState(GpioPinState state) = 0;
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
#ifndef STA_CORE_LANG_HPP
|
||||
#define STA_CORE_LANG_HPP
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup staCoreLang Lang
|
||||
* @ingroup staCore
|
||||
* @defgroup sta_core_lang Lang
|
||||
* @ingroup sta_core
|
||||
* @brief Compiler instructions.
|
||||
* @{
|
||||
*/
|
||||
|
@ -10,6 +10,8 @@ namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Interface for mutex objects.
|
||||
*
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
class Mutex
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ namespace sta
|
||||
/**
|
||||
* @brief Integer representation.
|
||||
*
|
||||
* @ingroup staCore
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
enum class IntegerBase
|
||||
{
|
||||
@ -28,7 +28,7 @@ namespace sta
|
||||
/**
|
||||
* @brief Printable interface for UART.
|
||||
*
|
||||
* @ingroup staCore
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
class PrintableUART
|
||||
{
|
||||
|
@ -10,6 +10,8 @@ namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Interface for signal objects.
|
||||
*
|
||||
* @ingroup sta_core
|
||||
*/
|
||||
class Signal
|
||||
{
|
||||
|
@ -9,8 +9,8 @@
|
||||
#define STA_CORE_STM32_CAN_HPP
|
||||
|
||||
/**
|
||||
* @defgroup stm32CAN CAN
|
||||
* @ingroup stm32
|
||||
* @defgroup sta_core_stm32_can CAN
|
||||
* @ingroup sta_core_stm32
|
||||
* @brief STM32 CAN module.
|
||||
*
|
||||
* Check @ref stm32BuildConfig for configuration options.
|
||||
@ -36,7 +36,7 @@ namespace sta
|
||||
/**
|
||||
* @brief Implementation of CanController interface using HAL.
|
||||
*
|
||||
* @ingroup stm32CAN
|
||||
* @ingroup sta_core_stm32_can
|
||||
*/
|
||||
class STM32CanController : public CanController
|
||||
{
|
||||
@ -99,7 +99,7 @@ namespace sta
|
||||
/**
|
||||
* @brief Global CAN instance.
|
||||
*
|
||||
* @ingroup stm32CAN
|
||||
* @ingroup sta_core_stm32_can
|
||||
*/
|
||||
extern STM32CanController CanBus;
|
||||
|
||||
@ -108,7 +108,7 @@ namespace sta
|
||||
*
|
||||
* May be implemented by application.
|
||||
*
|
||||
* @ingroup stm32CAN
|
||||
* @ingroup sta_core_stm32_can
|
||||
*/
|
||||
void CanBus_RxPendingCallback();
|
||||
#endif // STA_STM32_CAN_GLOBAL
|
||||
|
@ -5,30 +5,33 @@
|
||||
#ifndef STA_CORE_STM32_CLOCKS_HPP
|
||||
#define STA_CORE_STM32_CLOCKS_HPP
|
||||
|
||||
/**
|
||||
* @defgroup stm32 STM32
|
||||
* @brief Modules implemented for STM32 MCUs.
|
||||
*/
|
||||
|
||||
// Only enable module on STM32 platform
|
||||
#include <sta/config.hpp>
|
||||
|
||||
|
||||
#if defined(STA_PLATFORM_STM32) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/stm32/hal.hpp>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup stm32BuildConfig Build config
|
||||
* @ingroup stm32
|
||||
* @brief Build configuration options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup stm32Clocks Clocks
|
||||
* @ingroup stm32
|
||||
* @defgroup sta_core_stm32_clocks Clocks
|
||||
* @ingroup sta_core_stm32
|
||||
* @brief STM32 Clock queries.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
// Only enable module on STM32 platform
|
||||
#include <sta/config.hpp>
|
||||
#if defined(STA_PLATFORM_STM32) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/stm32/hal.hpp>
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Get peripheral clock frequency.
|
||||
*
|
||||
* @return Clock frequency
|
||||
*/
|
||||
using PCLKFreqFn = uint32_t (*)();
|
||||
} // namespace sta
|
||||
|
||||
|
||||
/**
|
||||
|
@ -11,14 +11,11 @@
|
||||
#ifndef STA_CORE_STM32_DELAY_HPP
|
||||
#define STA_CORE_STM32_DELAY_HPP
|
||||
|
||||
/**
|
||||
* @defgroup stm32Delay Delay
|
||||
* @ingroup stm32
|
||||
* @brief STM32 Delay module.
|
||||
*/
|
||||
|
||||
// Only enable module on STM32 platform
|
||||
#include <sta/config.hpp>
|
||||
|
||||
|
||||
#if defined(STA_PLATFORM_STM32) || defined(DOXYGEN)
|
||||
|
||||
#include <cstdint>
|
||||
@ -26,12 +23,18 @@
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @defgroup sta_core_stm32_delay Delay
|
||||
* @ingroup sta_core_stm32
|
||||
* @brief STM32 Delay module.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Millisecond delay.
|
||||
*
|
||||
* @param ms Milliseconds
|
||||
*
|
||||
* @ingroup stm32Delay
|
||||
*/
|
||||
void delayMs(uint32_t ms);
|
||||
|
||||
@ -40,11 +43,12 @@ namespace sta
|
||||
* @brief Microsecond delay.
|
||||
*
|
||||
* @param us Microseconds
|
||||
*
|
||||
* @ingroup stm32Delay
|
||||
*/
|
||||
void delayUs(uint32_t us);
|
||||
#endif // STA_STM32_DELAY_US_TIM
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
@ -5,11 +5,6 @@
|
||||
#ifndef STA_CORE_STM32_GPIO_PIN_HPP
|
||||
#define STA_CORE_STM32_GPIO_PIN_HPP
|
||||
|
||||
/**
|
||||
* @defgroup stm32GPIO GPIO
|
||||
* @ingroup stm32
|
||||
* @brief STM32 GPIO module.
|
||||
*/
|
||||
|
||||
// Only enable module on STM32 platform w/ HAL GPIO module enabled
|
||||
#include <sta/config.hpp>
|
||||
@ -26,13 +21,23 @@
|
||||
#include <sta/gpio_pin.hpp>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_stm32_gpio GPIO
|
||||
* @ingroup sta_core_stm32
|
||||
* @brief STM32 GPIO module.
|
||||
*/
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @ingroup sta_core_stm32_gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Container for STM GPIO Pin data.
|
||||
*
|
||||
* @ingroup stm32GPIO
|
||||
*/
|
||||
class STM32GpioPin : public GpioPin
|
||||
{
|
||||
@ -88,6 +93,9 @@ namespace sta
|
||||
* @return True if EXIT pin and trigger edge matches
|
||||
*/
|
||||
bool isInterruptEdge(const STM32GpioPin & pin, InterruptEdge edge);
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
/**
|
||||
@ -95,7 +103,7 @@ namespace sta
|
||||
*
|
||||
* @param label Pin label
|
||||
*
|
||||
* @ingroup stm32GPIO
|
||||
* @ingroup sta_core_stm32_gpio
|
||||
*/
|
||||
#define STA_STM32_GPIO_PIN(label) sta::STM32GpioPin{label##_GPIO_Port, label##_Pin}
|
||||
|
||||
|
@ -6,6 +6,13 @@
|
||||
#define STA_CORE_STM32_HAL_HPP
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_stm32 STM32
|
||||
* @ingroup sta_core_platforms
|
||||
* @brief Modules implemented for the STM32 platform.
|
||||
*/
|
||||
|
||||
|
||||
// Include STM32 HAL headers
|
||||
#include <main.h>
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace sta
|
||||
/**
|
||||
* @brief Initialize global HAL objects.
|
||||
*
|
||||
* @ingroup stm32
|
||||
* @ingroup sta_core_stm32
|
||||
*/
|
||||
void initHAL();
|
||||
} // namespace sta
|
||||
|
@ -5,12 +5,6 @@
|
||||
#ifndef STA_CORE_STM32_UART_HPP
|
||||
#define STA_CORE_STM32_UART_HPP
|
||||
|
||||
/**
|
||||
* @defgroup stm32UART UART
|
||||
* @ingroup stm32
|
||||
* @brief STM32 UART module.
|
||||
*/
|
||||
|
||||
|
||||
// Only enable module on STM32 platform w/ HAL UART module enabled
|
||||
#include <sta/config.hpp>
|
||||
@ -27,25 +21,32 @@
|
||||
#include <sta/uart.hpp>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_stm32_uart UART
|
||||
* @ingroup sta_core_stm32
|
||||
* @brief STM32 UART module.
|
||||
*/
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Implementation of UART interface using HAL.
|
||||
*
|
||||
* @ingroup stm32UART
|
||||
* @ingroup sta_core_stm32_uart
|
||||
*/
|
||||
class STM32UART : public UART
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param handle UART handle
|
||||
* @param handle STM32 HAL handle
|
||||
*/
|
||||
STM32UART(UART_HandleTypeDef * handle);
|
||||
|
||||
void write(const uint8_t * buffer, size_t size) override;
|
||||
|
||||
private:
|
||||
UART_HandleTypeDef * handle_; /**< UART handle */
|
||||
UART_HandleTypeDef * handle_; /**< STM32 HAL handle */
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
@ -9,10 +9,19 @@
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup sta_core_uart UART
|
||||
* @ingroup sta_core
|
||||
* @brief UART interface.
|
||||
*/
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Interface for %UART.
|
||||
*
|
||||
* @ingroup sta_core_uart
|
||||
*/
|
||||
class UART
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user