4#include DEF2STR(LIBXR_CH32_CONFIG_FILE)
6#include "ch32_uart_def.hpp"
7#include "double_buffer.hpp"
8#include "libxr_def.hpp"
25 uint16_t tx_gpio_pin, GPIO_TypeDef* rx_gpio_port, uint16_t rx_gpio_pin,
26 uint32_t pin_remap = 0, uint32_t tx_queue_size = 5,
34 void TxDmaIRQHandler();
47 size_t last_rx_pos_ = 0;
49 USART_TypeDef* instance_;
50 DMA_Channel_TypeDef* dma_rx_channel_;
51 DMA_Channel_TypeDef* dma_tx_channel_;
55 static CH32UART* map_[CH32_UART_NUMBER];
CH32 UART 驱动实现 / CH32 UART driver implementation.
void RxDmaIRQHandler()
DMA中断处理函数
ErrorCode SetConfig(UART::Configuration config)
设置 UART 配置 / Sets the UART configuration
CH32UART(ch32_uart_id_t id, RawData dma_rx, RawData dma_tx, GPIO_TypeDef *tx_gpio_port, uint16_t tx_gpio_pin, GPIO_TypeDef *rx_gpio_port, uint16_t rx_gpio_pin, uint32_t pin_remap=0, uint32_t tx_queue_size=5, UART::Configuration config={115200, UART::Parity::NO_PARITY, 8, 1})
构造 UART 对象 / Construct UART object
双缓冲区管理类 / Double buffer manager class
普通标志位(非原子)/ Non-atomic flag
原始数据封装类。 A class for encapsulating raw data.
ReadPort class for handling read operations.
通用异步收发传输(UART)基类 / Abstract base class for Universal Asynchronous Receiver-Transmitter (UART)
@ NO_PARITY
无校验 / No parity
WritePort class for handling write operations.
ErrorCode(* ReadFun)(ReadPort &port, bool in_isr)
Function pointer type for read operations.
ErrorCode(* WriteFun)(WritePort &port, bool in_isr)
Function pointer type for write operations.
UART 配置结构体 / UART configuration structure.