|
GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
|
串口设备对象。 更多...
#include <serial.h>


类 | |
| struct | info_type |
| 串口初始化参数。 更多... | |
Public 类型 | |
| using | key_type = std::uint8_t |
Public 成员函数 | |
| serial (info_type info) | |
| 打开并配置串口。 | |
| void | start () |
| 启动串口接收协程;重复调用不会重复启动。 | |
| awaitable< void > | send (key_type key, byte_span data) |
| 发送字节数据。 | |
| void | on_raw_data (callback_fn< byte_span > auto fn) |
| awaitable< void > | send_raw (byte_span data) |
| awaitable< void > | task () |
| 接收循环任务。 | |
| std::string | desc () const |
| 返回包含逻辑名称、设备路径和波特率的可读描述。 | |
Public 成员函数 继承自 roboctrl::io::keyed_io_base< uint8_t > | |
| void | on_data (const uint8_t &key, callback_fn< byte_span > auto fn, size_t size=0) |
| 注册指定 key 的回调。 | |
| void | on_data (const uint8_t &key, Fn &&fn) |
| 注册平凡类型包的回调。 | |
Public 成员函数 继承自 roboctrl::utils::immovable_base | |
| immovable_base (immovable_base &&)=delete | |
| immovable_base & | operator= (immovable_base &&)=delete |
Public 成员函数 继承自 roboctrl::utils::not_copyable_base | |
| not_copyable_base (const not_copyable_base &)=delete | |
| not_copyable_base & | operator= (const not_copyable_base &)=delete |
额外继承的成员函数 | |
Protected 成员函数 继承自 roboctrl::io::keyed_io_base< uint8_t > | |
| void | dispatch (const uint8_t &key, byte_span data) |
| 将数据派发给对应 key 的回调。 | |
| std::optional< size_t > | package_size (const uint8_t &key) const |
Protected 成员函数 继承自 roboctrl::log::logable< serial > | |
| void | log (log_level level, std::format_string< Args... > fmt, Args &&...args) const |
| 输出日志 | |
| void | log_debug (std::format_string< Args... > fmt, Args &&...args) const |
| 输出debug日志 | |
| void | log_info (std::format_string< Args... > fmt, Args &&...args) const |
| 输出info日志 | |
| void | log_warn (std::format_string< Args... > fmt, Args &&...args) const |
| 输出warn日志 | |
| void | log_error (std::format_string< Args... > fmt, Args &&...args) const |
| 输出error日志 | |
|
explicit |
打开并配置串口。
在文件 serial.cpp 第 15 行定义.
|
inline |
|
inline |
Dedicated raw stream for protocols that supply their own framing/CRC.
| roboctrl::awaitable< void > serial::send | ( | key_type | key, |
| byte_span | data | ||
| ) |
发送字节数据。
在文件 serial.cpp 第 39 行定义.
| roboctrl::awaitable< void > serial::send_raw | ( | byte_span | data | ) |
在文件 serial.cpp 第 54 行定义.
| void serial::start | ( | ) |
| roboctrl::awaitable< void > serial::task | ( | ) |
接收循环任务。
在文件 serial.cpp 第 93 行定义.
引用了 roboctrl::log::logable< serial >::log_warn() , 以及 roboctrl::io::make_shared_from().
被这些函数引用 start().