libxr 1.0
Want to be the best embedded framework
|
通用异步收发传输(UART)基类 / Abstract base class for Universal Asynchronous Receiver-Transmitter (UART) More...
#include <uart.hpp>
Data Structures | |
struct | Configuration |
UART 配置结构体 / UART configuration structure. More... | |
Public Types | |
enum class | Parity : uint8_t { NO_PARITY = 0 , EVEN = 1 , ODD = 2 } |
奇偶校验模式 / Parity mode More... | |
Public Member Functions | |
UART (size_t rx_queue_size, size_t rx_buffer_size, size_t tx_queue_size, size_t tx_buffer_size) | |
UART 构造函数 / UART constructor. | |
virtual ErrorCode | SetConfig (Configuration config)=0 |
设置 UART 配置 / Sets the UART configuration | |
Data Fields | |
ReadPort | read_port_ |
读取端口 / Read port | |
WritePort | write_port_ |
写入端口 / Write port | |
通用异步收发传输(UART)基类 / Abstract base class for Universal Asynchronous Receiver-Transmitter (UART)
该类定义了 UART 设备的基本接口,包括配置和数据传输端口。 This class defines the basic interface for a UART device, including configuration and data transmission ports.
|
strong |
|
inline |
rx_queue_size | 接收队列大小 / Receive queue size |
rx_buffer_size | 接收缓冲区大小 / Receive buffer size |
tx_queue_size | 发送队列大小 / Transmit queue size |
tx_buffer_size | 发送缓冲区大小 / Transmit buffer size |
该构造函数初始化 UART 的读取和写入端口。 This constructor initializes the read and write ports of the UART.
Definition at line 64 of file uart.hpp.
|
pure virtual |
设置 UART 配置 / Sets the UART configuration
ErrorCode::OK
,否则返回相应错误码 / Returns the operation status, ErrorCode::OK
if successful, otherwise an error code该方法为纯虚函数,子类必须实现具体的 UART 配置逻辑。 This is a pure virtual function. Subclasses must implement the specific UART configuration logic.
Implemented in LibXR::STM32UART, LibXR::STM32VirtualUART, and LibXR::LinuxUART.