Crate parse_sbus

source ·
Expand description

A small crate made to help parse SBUS packages from any source.

SBUS is a common standard used with radio transmitters and receivers in the RC hobby. SBUS is transmitted via UART at a baud rate of 100000 with 8 bits of data, an even parity bit, and 2 stop bits. Each UART frame contains 1 byte of SBUS data. 25 frames comprise a packet, which has the following bytes:

  • 1 header byte with a value of 0x0F
  • 22 bytes that store 16 channels of 11 bit information
  • 1 special flag byte that contains the values of the digital channels, whether the frame has been lost, and whether the failsafe has been engaged
  • 1 footer byte with a value of 0x00

The special flag byte has the following arrangement: [0 0 0 0 failsafe frame_lost channel17 channel18]

All of this data is transmitted with the least significant bit (LSB) first, hence the need to write this library.

Structs

  • The error type returned by try_from_bytes
  • A struct containing all the data for one SBUS packet

Enums

  • The different kinds of errors that result from try_from_bytes