Expand description
A lightweight binary framing protocol library.
This crate provides a minimal, allocation-free framing layer designed for embedded and resource-constrained environments. It focuses on deterministic binary encoding, checksum validation, and zero-copy decoding.
§Architecture Overview
-
ValidatorDefines CRC algorithms used to validate frames. -
DjiValidatorA concrete validator using DJI-compatible CRC8 and CRC16. -
MarshalerDescribes how a typed payload is serialized into bytes and deserialized from raw payload data. -
MessagerImplements frame packing and unpacking, combining framing, validation, and payload marshaling. -
RawFrameA validated, zero-copy view of a decoded frame.
§Typical Usage
- Implement
Marshalerfor your message types - Create a
Messagerwith a chosenValidator - Use
packto encode frames - Use
unpackto decode frames intoRawFrame - Use
Marshalerto convertRawFramepayloads to typed messages
§Frame Layout
+--------+--------+--------+--------+--------+---------+--------+
| SOF | LEN | SEQ | CRC8 | CMD_ID | DATA | CRC16 |
+--------+--------+--------+--------+--------+---------+--------+
| 1 byte | 2 byte | 1 byte | 1 byte | 2 byte | N bytes | 2 byte |
+--------+--------+--------+--------+--------+---------+--------+§Protocol Source
See RoboMaster Resources Hub for official documentation and protocol details: RMU Communication Protocol
Structs§
- DjiValidator
- DJI protocol CRC validator.
- Messager
- Frame encoder and decoder.
- RawFrame
- A validated, undecoded frame.
Enums§
- Marshaler
Error - Errors returned by
Marshaler::marshal,Marshaler::unmarshal, andRawFrame::unmarshal. - Pack
Error - Errors returned by
Messager::pack. - UnPack
Error - Errors returned by
Messager::unpackandMessager::unmarshal.
Traits§
- Impl
Command Msg - Provides the command ID and payload size constants for a message type.
- Impl
Marshal - Payload serialization half of
Marshaler. - Impl
UnMarshal - Payload deserialization half of
Marshaler. - Marshaler
- Payload marshaling interface.
- Validator
- CRC validator abstraction for the frame protocol.
Functions§
- calc_
dji8 - Calculate CRC8-DJI Checksum
- calc_
dji16 - Calculate CRC16-DJI Checksum