/** * @brief Implementation for UART using HAL. * * Define STA_HAL_UART_ENABLE in to enable. * * To enable the global DebugSerial instance (example using UART1) define: * #define STA_HAL_UART_DEBUG huart1 */ #ifndef STA_HAL_UART_HPP #define STA_HAL_UART_HPP #include #ifdef STA_HAL_UART_ENABLE #include #include namespace sta { /** * @brief Implementation of UART for HAL. */ class HalUART : public UART { public: /** * @param handle UART handle */ HalUART(UART_HandleTypeDef * handle); using UART::print; void write(const uint8_t * buffer, size_t size) override; private: UART_HandleTypeDef * handle_; /**< UART handle */ }; #ifdef STA_HAL_UART_DEBUG /** * @brief Global UART instance for debug output. */ extern HalUART DebugSerial; #endif // STA_HAL_UART_DEBUG } // namespace sta #endif // STA_HAL_UART_ENABLE #endif // STA_HAL_UART_HPP