motor_codec/lib.rs
1#![no_std]
2#![forbid(unsafe_code)]
3#![warn(missing_docs)]
4//! Vendor-agnostic motor codec contract.
5//!
6//! This crate defines [`MotorCodec`] — the single trait the rest of the
7//! `can-motor-control` stack uses to talk to a vendor-specific motor protocol —
8//! together with the shared types every vendor agrees on ([`CanFrame`],
9//! [`Command`], [`Event`], [`MotorTypeId`], [`Limits`], [`BusCapabilities`]).
10//!
11//! The crate is `no_std`. Vendor codec implementations (e.g. the `can-motor-damiao-codec` package)
12//! live in their own crates; `can-motor-control` depends on this trait crate only
13//! and never on a specific vendor.
14//!
15//! ```
16//! use motor_codec::{CanFrame, MotorCodec};
17//! // Trait is object-safe: usable as `Box<dyn MotorCodec>`.
18//! fn _accept_dyn(_c: alloc::boxed::Box<dyn MotorCodec>) {}
19//! # extern crate alloc;
20//! ```
21
22extern crate alloc;
23
24mod caps;
25mod codec;
26mod command;
27mod event;
28mod frame;
29mod motor;
30
31pub use caps::BusCapabilities;
32pub use codec::{CodecError, MotorCodec};
33pub use command::{Command, CommandKind};
34pub use event::{Event, ParamValue};
35pub use frame::{CanFrame, FrameError, FrameFlags};
36pub use motor::{Limits, MotorRef, MotorTypeId};