2022-05-09 21:19:06 +02:00

67 lines
1.1 KiB
C++

/**
* @file
* @brief Implementation of UART using STM32 HAL.
*/
#ifndef STA_STM32_UART_HPP
#define STA_STM32_UART_HPP
/**
* @defgroup stm32UART UART
* @ingroup stm32
* @brief STM32 UART module.
*/
#ifdef DOXYGEN
/**
* @def STA_STM32_UART_ENABLE
* @brief Enable module.
*
* @ingroup stm32BuildConfig
*/
# define STA_STM32_UART_ENABLE
/**
* @def STA_STM32_UART_DEBUG_SERIAL
* @brief Create global sta::DebugSerial object using this HAL UART instance.
*
* @ingroup stm32BuildConfig
*/
# define STA_STM32_UART_DEBUG_SERIAL
#endif // DOXYGEN
#include <sta/config.hpp>
#ifdef STA_STM32_UART_ENABLE
#include <sta/intf/uart.hpp>
#include <sta/stm32/hal.hpp>
namespace sta
{
/**
* @brief Implementation of UART interface using HAL.
*
* @ingroup stm32UART
*/
class STM32UART : public UART
{
public:
/**
* @param handle UART handle
*/
STM32UART(UART_HandleTypeDef * handle);
void write(const uint8_t * buffer, size_t size) override;
private:
UART_HandleTypeDef * handle_; /**< UART handle */
};
} // namespace sta
#endif // STA_STM32_UART_ENABLE
#endif // STA_STM32_UART_HPP