63 template <
typename ReadPortType = ReadPort,
typename WritePortType = WritePort>
64 UART(ReadPortType* read_port, WritePortType* write_port)
81 template <
typename OperationType,
typename = std::enable_if_t<std::is_base_of_v<
85 return (*
write_port_)(data, std::forward<OperationType>(op));
88 template <
typename OperationType,
typename = std::enable_if_t<std::is_base_of_v<
90 ErrorCode Read(
RawData data, OperationType&& op)
92 return (*
read_port_)(data, std::forward<OperationType>(op));
常量原始数据封装类。 A class for encapsulating constant raw data.
原始数据封装类。 A class for encapsulating raw data.
ReadPort class for handling read operations.
通用异步收发传输(UART)基类 / Abstract base class for Universal Asynchronous Receiver-Transmitter (UART)
ReadPort * read_port_
读取端口 / Read port
Parity
奇偶校验模式 / Parity mode
@ NO_PARITY
无校验 / No parity
virtual ErrorCode SetConfig(Configuration config)=0
设置 UART 配置 / Sets the UART configuration
WritePort * write_port_
写入端口 / Write port
UART(ReadPortType *read_port, WritePortType *write_port)
UART 构造函数 / UART constructor.
WritePort class for handling write operations.
Operation< ErrorCode > ReadOperation
Read operation type.
Operation< ErrorCode > WriteOperation
Write operation type.
UART 配置结构体 / UART configuration structure.
uint8_t stop_bits
停止位长度 / Number of stop bits
Parity parity
校验模式 / Parity mode
uint8_t data_bits
数据位长度 / Number of data bits
uint32_t baudrate
波特率 / Baud rate