#pragma once #include #include #include #include "stm32f401xe.h" #include "stm32f4xx_hal.h" #include "stm32f4xx_hal_uart.h" namespace driver::usart { class Usart { public: explicit Usart(USART_TypeDef* usart, uint32_t baudRate, uint32_t wordLength, uint32_t stopBits, uint32_t parity, uint32_t mode, uint32_t hwFlowCtl, uint32_t overSampling); ~Usart() = default; bool init(); void print(const std::string_view str); void println(const std::string_view str); private: UART_HandleTypeDef mHandle{}; void tx(std::string_view range); void flush(); }; } // namespace driver::usart