Skip to main content

odrive_can_protocol/
lib.rs

1// Copyright The odrive-can-protocol Contributors
2
3//! ODrive CANSimple 协议库入口,提供版本明确的编解码 API 与硬件无关帧类型。
4//!
5//! 默认仅使用 core;可选 feature 提供驱动帧转换,不执行设备收发或控制。
6
7#![no_std]
8#![forbid(unsafe_code)]
9#![deny(missing_docs)]
10#![doc = include_str!("../README.md")]
11
12#[cfg(all(feature = "socketcan", not(target_os = "linux")))]
13compile_error!("feature `socketcan` requires a Linux target");
14
15/// 按 feature 启用的驱动帧转换。
16#[cfg(feature = "embedded-can")]
17pub mod compat;
18
19/// 与硬件无关的 CAN 帧表示。
20pub mod frame;
21/// ODrive 固件 `fw-v0.5.1` 的 CANSimple 协议。
22pub mod fw_v0_5_1;
23
24pub use frame::{EncodedFrame, FrameId, FramePayload, FrameRef};
25pub use fw_v0_5_1::{
26    AxisState, Command, DecodeError, EncodeError, Message, NodeId, Query, Response, decode, encode,
27};