sta-core/include/sta/hal/uart.hpp
2022-05-08 03:11:12 +02:00

66 lines
1.1 KiB
C++

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