Expand description
Serial API frames.
A data frame is SOF LEN TYPE FUNC PAYLOAD.. CHECKSUM, where LEN counts
the bytes after itself (type, function, payload and checksum) and the
checksum is 0xFF XOR every byte from LEN to the end of the payload.
Single-byte frames acknowledge (ACK), reject (NAK) or signal a
collision (CAN).
Structs§
- Data
Frame - A data frame.
- Frame
Codec - Streaming codec for Serial API frames.
Enums§
- Frame
- One unit on the wire.
- Frame
Type - Request (host to controller, or an unsolicited controller frame) or response.
Constants§
- ACK
- Acknowledge.
- CAN
- Cancel: the receiver was sending a frame itself.
- MAX_
PAYLOAD - Longest payload a frame can carry: LEN is one byte and counts type, function and checksum too.
- NAK
- Negative acknowledge (bad checksum or timeout on the receiver).
- SOF
- Start of frame.
Functions§
- checksum
- The Serial API checksum over
LEN..=last payload byte. - decode_
all - Decodes every complete frame in
bytes(for tests and fuzzing).