Expand description
§sbus-rs
A no_std compatible library for parsing SBUS (Serial Bus) protocol, commonly used in RC (Radio Control) systems. SBUS is a protocol developed by Futaba for RC receivers to communicate with flight controllers and other devices.
§Features
blocking
: Enables blocking I/O operations (enabled by default)async
: Enables async I/O operationsstd
: Enables standard library features
§Example
use sbus_rs::{SbusParser, SbusPacket};
use embedded_io_adapters::std::FromStd;
use std::io::Cursor;
let data = [0x0F, /* ... SBUS frame data ... */ 0x00];
let cursor = Cursor::new(data);
let mut parser = SbusParser::new(FromStd::new(cursor));
match parser.read_frame() {
Ok(packet) => {
println!("Channel 1 value: {}", packet.channels[0]);
if packet.flags.failsafe {
println!("Failsafe active!");
}
}
Err(e) => println!("Error reading frame: {:?}", e),
}
§Protocol Details
SBUS frames are 25 bytes long with the following structure:
- Start byte (0x0F)
- 22 bytes of channel data (16 channels, 11 bits each)
- 1 byte of flags
- End byte (0x00)
Modules§
Structs§
- Flags
- Status flags contained in an SBUS frame
- Parser
- Sbus
Packet - Represents a complete SBUS packet with channel data and flags
- Sbus
Parser - Parser for reading SBUS frames from a blocking I/O source
- Sbus
Parser Async
Enums§
- Sbus
Error - Error types for SBUS operations
Constants§
- CHANNEL_
COUNT - The number of channels in a SBus Frame.
- CHANNEL_
MAX - The maximum value of a channel.
- SBUS_
FOOTER - The SBus Frame footer should end with a zero byte
0x00
(0 decimal). - SBUS_
FRAME_ LENGTH - The SBus Frame length
- SBUS_
HEADER - The SBus Frame header should start with
0x0F
byte (15 decimal).