Expand description
§UniStore Serial
串口通信能力模块,提供 RS232/UART 通信支持。
§功能特性
- 串口发现与枚举
- 配置管理(波特率、数据位、停止位、校验)
- 异步读写操作
- 超时控制
- 流控制(RTS/CTS、XON/XOFF)
§使用示例
ⓘ
use unistore_serial::{SerialPort, SerialConfig};
// 列出可用串口
let ports = SerialPort::list_ports()?;
// 打开串口
let config = SerialConfig::default()
.with_baud_rate(115200)
.with_timeout_ms(1000);
let mut port = SerialPort::open("COM1", config)?;
// 写入数据
port.write(b"AT\r\n")?;
// 读取响应
let response = port.read_line()?;Structs§
- Port
Info - 串口信息
- Serial
Capability - 串口通信能力
- Serial
Config - 串口配置
- Serial
Config Builder - 串口配置构建器
- Serial
Port - 串口包装器
Enums§
- Data
Bits - 数据位
- Flow
Control - 流控制
- Parity
- 校验位
- Port
Type - 串口类型
- Serial
Error - 串口错误
- Stop
Bits - 停止位
Functions§
- find_
by_ vid_ pid - 按 VID/PID 查找串口
- list_
ports - 列出系统中的所有串口
- list_
usb_ ports - 列出 USB 串口
- port_
exists - 检查串口是否存在