sbus-rs
A no_std compatible Rust implementation of the SBUS (Serial Bus) protocol parser, commonly used in RC (Radio Control) applications. Part of the AeroRust organization, dedicated to aerospace-related software in Rust.
Features
- ๐ฆ Pure Rust implementation
- ๐ซ
no_std
compatible for embedded systems - โก Async and blocking IO support
- ๐ Robust error handling and validation
- ๐งช Thoroughly tested with unit tests, property-based tests, and fuzzing
- ๐ Benchmarked for performance optimization
- ๐ ๏ธ Zero-copy parsing for efficient memory usage
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0"
For async support:
[]
= { = "0.1.0", = ["async"] }
Usage
Blocking Example
use ;
use FromStd;
Async Example
use ;
use FromTokio;
async
Protocol Details
SBUS frames consist of:
- Start byte (0x0F)
- 22 bytes of channel data (16 channels, 11 bits each)
- 1 byte of flags
- End byte (0x00)
Channel values range from 0 to 2047 (11 bits).
Flag bits:
- Digital Channel 1
- Digital Channel 2
- Frame Lost
- Failsafe Active
Performance
The library is optimized for performance with careful consideration of:
- Zero-copy parsing
- Efficient bit manipulation
- Minimal allocations
- Vectorization opportunities
Benchmarks are available and can be run with:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. Make sure to:
- Run the full test suite:
cargo test --all-features
- Run benchmarks:
cargo bench
- Run clippy:
cargo clippy --all-features
- Format code:
cargo fmt
Safety
The crate uses safe Rust and includes:
- Miri checks for undefined behavior
- Memory sanitizer tests
- Fuzzing tests
- Property-based testing
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Part of the AeroRust organization, promoting the use of Rust in aerospace applications.
Special thanks to:
- The AeroRust community
- Contributors and maintainers
- The Rust embedded community