Expand description
Vendor-agnostic motor codec contract.
This crate defines MotorCodec — the single trait the rest of the
can-motor-control stack uses to talk to a vendor-specific motor protocol —
together with the shared types every vendor agrees on (CanFrame,
Command, Event, MotorTypeId, Limits, BusCapabilities).
The crate is no_std. Vendor codec implementations (e.g. the can-motor-damiao-codec package)
live in their own crates; can-motor-control depends on this trait crate only
and never on a specific vendor.
use motor_codec::{CanFrame, MotorCodec};
// Trait is object-safe: usable as `Box<dyn MotorCodec>`.
fn _accept_dyn(_c: alloc::boxed::Box<dyn MotorCodec>) {}Structs§
- BusCapabilities
- Runtime feature set of a CAN transport.
- CanFrame
- Unified CAN frame: covers both classical CAN (8-byte payload) and CAN-FD (up to 64-byte payload).
- Frame
Flags - Metadata bits attached to every
CanFrame. - Limits
- Per-motor-type physical limits used to scale MIT commands and unscale state replies.
- Motor
Ref - Borrowed view of a motor’s identity, suitable for passing into codec encode methods without taking ownership of the motor’s mutable state.
Enums§
- Codec
Error - Errors returned by
MotorCodecimplementations. - Command
- A control command directed at a single motor.
- Command
Kind - Tagged discriminant of
Command, suitable for error-reporting “this codec does not support mode X”. - Event
- A decoded inbound message from a motor.
- Frame
Error - Errors that can arise constructing a
CanFrame. - Motor
Type Id - Vendor-tagged motor type identifier.
- Param
Value - Union of value encodings used by vendor parameter sub-protocols.
Traits§
- Motor
Codec - The vendor-agnostic codec contract.