Fix indentation. Update doxygen comments

This commit is contained in:
Henrik Stickann
2023-02-02 22:22:14 +01:00
parent fc4eed38d5
commit 59585b2ae5
46 changed files with 2020 additions and 1960 deletions

View File

@@ -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.
@@ -33,84 +33,84 @@
namespace sta
{
/**
* @brief Implementation of CanController interface using HAL.
*
* @ingroup stm32CAN
*/
class STM32CanController : public CanController
{
public:
static constexpr uint8_t MAX_FILTER_COUNT = 14; /**< Max number of filters */
static constexpr uint8_t MAX_FIFO_COUNT = 2; /**< Max number of FIFOs */
static constexpr uint8_t MAX_PAYLOAD_SIZE = 8; /**< Maximum payload size */
/**
* @brief Implementation of CanController interface using HAL.
*
* @ingroup sta_core_stm32_can
*/
class STM32CanController : public CanController
{
public:
static constexpr uint8_t MAX_FILTER_COUNT = 14; /**< Max number of filters */
static constexpr uint8_t MAX_FIFO_COUNT = 2; /**< Max number of FIFOs */
static constexpr uint8_t MAX_PAYLOAD_SIZE = 8; /**< Maximum payload size */
public:
/**
* @param handle CAN handle
*/
STM32CanController(CAN_HandleTypeDef * handle);
public:
/**
* @param handle CAN handle
*/
STM32CanController(CAN_HandleTypeDef * handle);
/**
* @brief Enable RX pending interrupts.
*/
void enableRxInterrupts();
/**
* @brief Enable RX pending interrupts.
*/
void enableRxInterrupts();
/**
* @brief Start CAN controller.
*/
void start();
/**
* @brief Stop CAN controller.
*/
void stop();
/**
* @brief Start CAN controller.
*/
void start();
/**
* @brief Stop CAN controller.
*/
void stop();
// RX/TX
//
// RX/TX
//
bool sendFrame(const CanTxHeader & header, const uint8_t * payload) override;
bool receiveFrame(uint8_t fifo, CanRxHeader * header, uint8_t * payload) override;
bool sendFrame(const CanTxHeader & header, const uint8_t * payload) override;
bool receiveFrame(uint8_t fifo, CanRxHeader * header, uint8_t * payload) override;
uint32_t getRxFifoFlags() override;
uint32_t getRxFifoFlags() override;
// RX Filter
//
// RX Filter
//
void configureFilter(uint8_t idx, const CanFilter & filter, bool active = false) override;
void enableFilter(uint8_t idx) override;
void disableFilter(uint8_t idx) override;
void clearFilters() override;
void configureFilter(uint8_t idx, const CanFilter & filter, bool active = false) override;
void enableFilter(uint8_t idx) override;
void disableFilter(uint8_t idx) override;
void clearFilters() override;
private:
/**
* @brief Initialize filter settings.
*/
void initFilters();
private:
/**
* @brief Initialize filter settings.
*/
void initFilters();
private:
CAN_HandleTypeDef * handle_; /**< CAN handle */
CAN_FilterTypeDef filters_[MAX_FILTER_COUNT]; /**< Filter settings */
};
private:
CAN_HandleTypeDef * handle_; /**< CAN handle */
CAN_FilterTypeDef filters_[MAX_FILTER_COUNT]; /**< Filter settings */
};
#if defined(STA_STM32_CAN_GLOBAL) || DOXYGEN
/**
* @brief Global CAN instance.
*
* @ingroup stm32CAN
*/
extern STM32CanController CanBus;
/**
* @brief Global CAN instance.
*
* @ingroup sta_core_stm32_can
*/
extern STM32CanController CanBus;
/**
* @brief Interrupt handler for pending RX frames.
*
* May be implemented by application.
*
* @ingroup stm32CAN
*/
void CanBus_RxPendingCallback();
/**
* @brief Interrupt handler for pending RX frames.
*
* May be implemented by application.
*
* @ingroup sta_core_stm32_can
*/
void CanBus_RxPendingCallback();
#endif // STA_STM32_CAN_GLOBAL
} // namespace sta

View File

@@ -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
/**

View File

@@ -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,25 +23,32 @@
namespace sta
{
/**
* @brief Millisecond delay.
*
* @param ms Milliseconds
*
* @ingroup stm32Delay
*/
void delayMs(uint32_t ms);
/**
* @defgroup sta_core_stm32_delay Delay
* @ingroup sta_core_stm32
* @brief STM32 Delay module.
* @{
*/
/**
* @brief Millisecond delay.
*
* @param ms Milliseconds
*/
void delayMs(uint32_t ms);
#if defined(STA_STM32_DELAY_US_TIM) || defined(DOXYGEN)
/**
* @brief Microsecond delay.
*
* @param us Microseconds
*
* @ingroup stm32Delay
*/
void delayUs(uint32_t us);
/**
* @brief Microsecond delay.
*
* @param us Microseconds
*/
void delayUs(uint32_t us);
#endif // STA_STM32_DELAY_US_TIM
/** @} */
} // namespace sta

View File

@@ -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,68 +21,81 @@
#include <sta/gpio_pin.hpp>
/**
* @defgroup sta_core_stm32_gpio GPIO
* @ingroup sta_core_stm32
* @brief STM32 GPIO module.
*/
namespace sta
{
/**
* @brief Container for STM GPIO Pin data.
*
* @ingroup stm32GPIO
*/
class STM32GpioPin : public GpioPin
{
public:
/**
* @param port GPIO port
* @param pin Pin index
*/
STM32GpioPin(GPIO_TypeDef * port, uint16_t pin);
void setState(GpioPinState state) override;
/**
* @brief Get GPIO port for pin.
*
* @return GPIO port
*/
GPIO_TypeDef * getPort() const;
/**
* @brief Get pin index for pin.
*
* @return Pin index
*/
uint16_t getPin() const;
/**
* @brief Get GPIO port index for pin.
*
* @return GPIO port index
*/
uint8_t getPortIndex() const;
private:
GPIO_TypeDef * port_; /**< GPIO port */
uint16_t pin_; /**< GPIO pin */
};
/**
* @ingroup sta_core_stm32_gpio
* @{
*/
/**
* @brief Interrupt trigger edge.
*/
enum class InterruptEdge
{
RISING, /**< Rising edge */
FALLING, /**< Falling edge */
BOTH /**< Rising and falling edge */
};
/**
* @brief Container for STM GPIO Pin data.
*/
class STM32GpioPin : public GpioPin
{
public:
/**
* @param port GPIO port
* @param pin Pin index
*/
STM32GpioPin(GPIO_TypeDef * port, uint16_t pin);
/**
* @brief Check pin EXIT pin configuration.
*
* @param pin GPIO pin
* @param edge Interrupt trigger edge
* @return True if EXIT pin and trigger edge matches
*/
bool isInterruptEdge(const STM32GpioPin & pin, InterruptEdge edge);
void setState(GpioPinState state) override;
/**
* @brief Get GPIO port for pin.
*
* @return GPIO port
*/
GPIO_TypeDef * getPort() const;
/**
* @brief Get pin index for pin.
*
* @return Pin index
*/
uint16_t getPin() const;
/**
* @brief Get GPIO port index for pin.
*
* @return GPIO port index
*/
uint8_t getPortIndex() const;
private:
GPIO_TypeDef * port_; /**< GPIO port */
uint16_t pin_; /**< GPIO pin */
};
/**
* @brief Interrupt trigger edge.
*/
enum class InterruptEdge
{
RISING, /**< Rising edge */
FALLING, /**< Falling edge */
BOTH /**< Rising and falling edge */
};
/**
* @brief Check pin EXIT pin configuration.
*
* @param pin GPIO pin
* @param edge Interrupt trigger edge
* @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}

View File

@@ -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>

View File

@@ -8,12 +8,12 @@
namespace sta
{
/**
* @brief Initialize global HAL objects.
*
* @ingroup stm32
*/
void initHAL();
/**
* @brief Initialize global HAL objects.
*
* @ingroup sta_core_stm32
*/
void initHAL();
} // namespace sta

View File

@@ -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,26 +21,33 @@
#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
*/
class STM32UART : public UART
{
public:
/**
* @param handle UART handle
*/
STM32UART(UART_HandleTypeDef * handle);
/**
* @brief Implementation of UART interface using HAL.
*
* @ingroup sta_core_stm32_uart
*/
class STM32UART : public UART
{
public:
/**
* @param handle STM32 HAL handle
*/
STM32UART(UART_HandleTypeDef * handle);
void write(const uint8_t * buffer, size_t size) override;
void write(const uint8_t * buffer, size_t size) override;
private:
UART_HandleTypeDef * handle_; /**< UART handle */
};
private:
UART_HandleTypeDef * handle_; /**< STM32 HAL handle */
};
} // namespace sta