From e4f5e3cd2e63b260ee30ae93770a52af958ce030 Mon Sep 17 00:00:00 2001 From: Henrik Stickann <4376396-Mithradir@users.noreply.gitlab.com> Date: Tue, 10 May 2022 02:11:40 +0200 Subject: [PATCH] Update doc --- include/sta/stm32/clocks.hpp | 23 ++++++++++++++++++++--- include/sta/stm32/gpio_pin.hpp | 30 ++++++++++++++++++++++++++++-- src/gpio_pin.cpp | 2 +- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/include/sta/stm32/clocks.hpp b/include/sta/stm32/clocks.hpp index 65e5d27..748f3c8 100644 --- a/include/sta/stm32/clocks.hpp +++ b/include/sta/stm32/clocks.hpp @@ -19,7 +19,7 @@ /** * @defgroup stm32Clocks Clocks * @ingroup stm32 - * @brief STM32 clock queries. + * @brief STM32 Clock queries. * @{ */ @@ -36,11 +36,28 @@ #define STA_STM32_GET_PCLK_FREQ_FN(n) HAL_RCC_GetPCLK ## n ## Freq -// Internal helper for macro expansion +/** + * @brief Internal helper for macro expansion. + * + * @param n PCLK index + * @return Function returning PCLK frequency + */ #define _STA_STM32_GET_PCLK_FREQ_FN(n) STA_STM32_GET_PCLK_FREQ_FN(n) -// Get instance to PCLK index map macro +/** + * @brief Map instance name to PCLK index. + * + * @param type Hardware type + * @param idx Instance index + * @return PCLK index + */ #define _STA_STM32_PCLK_IDX_MAP(type, idx) STA_STM32_ ## type ## _ ## idx ## _PCLK_IDX // Get HAL handle to PCLK index map macro +/** + * @brief Map instance handle to PCLK index. + * + * @param handle HAL handle + * @return PCLK index + */ #define _STA_STM32_HANDLE_PCLK_IDX_MAP(handle) STA_STM32_ ## handle ## _PCLK_IDX diff --git a/include/sta/stm32/gpio_pin.hpp b/include/sta/stm32/gpio_pin.hpp index 8fc5938..b340551 100644 --- a/include/sta/stm32/gpio_pin.hpp +++ b/include/sta/stm32/gpio_pin.hpp @@ -8,7 +8,7 @@ /** * @defgroup stm32GPIO GPIO * @ingroup stm32 - * @brief STM GPIO module. + * @brief STM32 GPIO module. */ #ifdef DOXYGEN @@ -40,13 +40,32 @@ namespace sta 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; - uint8_t getIndex() const; + /** + * @brief Get GPIO port index for pin. + * + * @return GPIO port index + */ + uint8_t getPortIndex() const; private: GPIO_TypeDef * port_; /**< GPIO port */ @@ -64,6 +83,13 @@ namespace sta 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 diff --git a/src/gpio_pin.cpp b/src/gpio_pin.cpp index cb52d1d..11f841e 100644 --- a/src/gpio_pin.cpp +++ b/src/gpio_pin.cpp @@ -28,7 +28,7 @@ namespace sta return pin_; } - uint8_t STM32GpioPin::getIndex() const + uint8_t STM32GpioPin::getPortIndex() const { return GPIO_GET_INDEX(port_); }