uf-dshot
uf-dshot is a no_std Rust crate for packing and unpacking DShot frames. It supports standard DShot command and throttle frames, bidirectional DShot telemetry, and an STM32 example backend for Embassy based projects.
Features
- Encode DShot throttle and command frames
- Request telemetry on the separate wire for standard DShot
- Decode bidirectional DShot telemetry from the same wire
- Provide protocol level types and timing hints for platform code
- Offer an STM32 specific integration layer behind the
embassy-stm32feature
Features
defmt- Enables
defmt::Formatfor public types
- Enables
embassy-stm32- Enables Embassy based STM32 helpers
- Pulls in
embassy-sync,embassy-time, and the STM32 HAL dependency
Installation
Add the crate to Cargo.toml:
[]
= "0.1"
Enable features when needed:
[]
= { = "0.1", = ["defmt", "embassy-stm32"] }
Or use Cargo:
Core Example (Platform Agnostic)
use ;
For command execution timing, use Command::exec_policy().
Commands that are often documented with 6 repeats use a conservative 10-repeat policy in this crate (similar to Betaflight).
STM32 Embassy Example
use ;
use panic_halt as _;
use Spawner;
use ;
use DshotSpeed;
use ;
const ESC_SPEED: DshotSpeed = Dshot300;
const DEMO_THROTTLE: u16 = 150;
const LOG_INTERVAL: u32 = 100;
const LOG_INTERVAL_ERR: u32 = 1;
bind_interrupts!;
async
Inspirations
- https://github.com/symonb/Bidirectional-DSHOT-and-RPM-Filter
- https://symonb.github.io/docs/drone/ESC/ESC_prot_impl_2_2
- https://brushlesswhoop.com/dshot-and-bidirectional-dshot/
- https://github.com/Ragarnoy/embassy-dshot
License
This project is licensed under the Apache 2.0. See the LICENSE file for details.