Skip to main content

Module frame

Module frame 

Source
Expand description

ASH frames: control byte, data randomization, CRC and byte stuffing.

Modules§

reset_code
Reset codes an NCP reports in RSTACK and ERROR frames.

Structs§

Decoder
Splits a received byte stream into frames: removes stuffing, honours the cancel and substitute bytes, ignores XON/XOFF, and bounds the buffer at MAX_FRAME_LEN so a stream without flags cannot grow memory.

Enums§

Frame
One ASH frame.
FrameError
Why a received frame was dropped.

Constants§

ASH_VERSION
The ASH protocol version this crate speaks.
CANCEL
Cancel byte: discards the frame in progress.
ESCAPE
Escape byte: the next byte is XORed with FLIP.
FLAG
Flag byte: ends every frame.
FLIP
XOR applied to an escaped byte.
MAX_DATA_LEN
Largest DATA field (the largest EZSP frame).
MAX_FRAME_LEN
Largest frame before stuffing: control, data and CRC.
MIN_DATA_LEN
Smallest DATA field (the smallest EZSP frame).
SUBSTITUTE
Substitute byte: a low-level receive error replaced a byte; the frame is bad.
XOFF
Software flow control: pause.
XON
Software flow control: resume.

Functions§

randomize
XOR data with ASH’s pseudo-random sequence (seed 0x42, polynomial 0xB8). Applying it twice restores the input.