3#include "libxr_def.hpp"
11class TinyUSBVirtualUART;
22 void Reset() { read_size_ = 0; }
24 using ReadPort::operator=;
38 void Reset() { write_size_ = 0; }
40 using WritePort::operator=;
56 void Poll() { tud_task(); }
57 size_t Available()
const {
return tud_cdc_available(); }
58 bool Connected()
const {
return tud_cdc_connected(); }
ReadPort class for handling read operations.
ReadPort(size_t buffer_size=128)
Constructs a ReadPort with queue sizes.
size_t Size()
获取当前已用空间(接收数据量)
void Reset()
Resets the ReadPort.
size_t EmptySize()
返回FIFO可用空间(空余字节数)
void ProcessPendingReads(bool in_isr=true)
处理等待中的读操作
size_t Size()
获取已写入空间(写入但未发送的字节数)
void Reset()
Resets the WritePort.
size_t EmptySize()
返回FIFO可写空间(空余字节数)
ErrorCode SetConfig(UART::Configuration config) override
配置CDC,无实际动作
TinyUSBVirtualUART()
TinyUSB虚拟串口构造
friend void tud_cdc_rx_cb(uint8_t itf)
CDC 接收回调(由TinyUSB调用)
通用异步收发传输(UART)基类 / Abstract base class for Universal Asynchronous Receiver-Transmitter (UART)
WritePort class for handling write operations.
WritePort(size_t queue_size=3, size_t buffer_size=128)
构造一个新的 WritePort 对象。 Constructs a new WritePort object.
ErrorCode(* ReadFun)(ReadPort &port)
Function pointer type for read operations.
ErrorCode(* WriteFun)(WritePort &port)
Function pointer type for write operations.
UART 配置结构体 / UART configuration structure.