MAVLink2.CRC (mavlink2 v0.1.0)

Copy Markdown View Source

MAVLink's checksum: CRC-16/MCRF4XX, also called the X.25 CRC, as MAVLink's crc_accumulate computes it (seed 0xFFFF).

Summary

Functions

Fold one byte into crc.

Fold every byte of bin into crc.

The frame checksum over bin, finished with crc_extra.

The initial accumulator value, 0xFFFF.

Functions

accumulate(crc, byte)

@spec accumulate(0..65535, 0..255) :: 0..65535

Fold one byte into crc.

Separate from accumulate_bytes/2 because a frame's checksum runs over the header and payload and then over the message's crc_extra, which is not contiguous with either.

accumulate_bytes(crc, bin)

@spec accumulate_bytes(0..65535, binary()) :: 0..65535

Fold every byte of bin into crc.

checksum(bin, crc_extra)

@spec checksum(binary(), 0..255) :: 0..65535

The frame checksum over bin, finished with crc_extra.

crc_extra is the per-message byte from the dialect: two peers with different definitions of a message fail the checksum instead of misreading its fields.

seed()

@spec seed() :: 0..65535

The initial accumulator value, 0xFFFF.