Drone. Adapters. Crazyflie. SafeLink
(ex_drone v0.3.0)
View Source
Bitcraze SafeLink helpers for Crazyradio CRTP framing.
SafeLink uses the two reserved link bits in the CRTP header as alternating uplink / downlink counters so neither side silently drops ACK payloads.
Enable negotiation (raw USB bytes, not a normal CRTP encode):
<<0xFF, 0x05, 0x01>>Success when the ACK data echoes the same three bytes. Framing then stamps:
header = (header &&& 0xF3) ||| (up <<< 3) ||| (down <<< 2)Counters advance only on ACK: uplink always flips; downlink flips when the ACK payload header carries the expected downlink bit.
Summary
Functions
Advances counters after a successful ACK.
Raw USB disable packet (<<0xFF, 0x05, 0x00>>).
Raw USB enable packet (<<0xFF, 0x05, 0x01>>).
True when ACK downlink data echoes the enable packet.
Applies SafeLink framing to an encoded CRTP binary.
Stamps SafeLink uplink/downlink bits into a CRTP header byte.
Functions
@spec advance(0 | 1, 0 | 1, byte() | nil) :: {0 | 1, 0 | 1}
Advances counters after a successful ACK.
downlink_header is the first byte of ACK data when present, otherwise
nil (empty ACK payload — uplink still flips).
@spec disable_packet() :: <<_::24>>
Raw USB disable packet (<<0xFF, 0x05, 0x00>>).
@spec enable_packet() :: <<_::24>>
Raw USB enable packet (<<0xFF, 0x05, 0x01>>).
True when ACK downlink data echoes the enable packet.
Applies SafeLink framing to an encoded CRTP binary.
Stamps SafeLink uplink/downlink bits into a CRTP header byte.