Class Crc16

Namespace
MavNet.Protocol
Assembly
MavNet.Protocol.dll

CRC-16/MCRF4XX — the checksum MAVLink uses on every frame. The MAVLink community commonly calls this "CRC-16/X.25", but the reference C implementation omits the X.25 final XOR (xorout=0x0000), which is formally CRC-16/MCRF4XX (poly=0x1021, init=0xFFFF, refin/refout=true, check=0x6F91). Match the reference implementation byte-for-byte so PX4 accepts our outbound frames. Public because the code generator (tools/MavNet.CodeGen) reuses it for CRC_EXTRA computation.

public static class Crc16
Inheritance
Crc16
Inherited Members

Methods

Accumulate(byte, ushort)

Accumulates a single byte into a running CRC-16/X.25 checksum.

public static ushort Accumulate(byte b, ushort crc)

Parameters

b byte
crc ushort

Returns

ushort

Accumulate(ReadOnlySpan<byte>, ushort)

Accumulates a span of bytes into a CRC-16/X.25 checksum.

public static ushort Accumulate(ReadOnlySpan<byte> data, ushort crc = 65535)

Parameters

data ReadOnlySpan<byte>
crc ushort

Returns

ushort