pub struct DshotTelemetryFrame(/* private fields */);Expand description
DshotTelemetryFrame: transmitted from the ESC to the Flight Controller (FC).
If Bidirectional Dshot is enabled and the Flight Controller sends a DshotCommandFrame
with the telemetry request bit set, the FC shifts its signal pin to an input right after
transmission finishes. The ESC then responds with a DshotTelemetryFrame.
This frame can be interpreted either as an eRPM (Electronic RPM) value, or an EDT
(Extended Dshot Telemetry) sensor payload.
§eRPM Interpretation
When parsed as an eRPM frame, the 16-bit word uses the layout:
eeem mmmm mmmm cccce: 3-bit exponentm: 9-bit mantissac: 4-bit inverted XOR checksum
The 9-bit mantissa value (M) is shifted left by the exponent (E) to calculate the core commutation period in microseconds (M << E). This yields a period range of 1 µs to 65,408 µs, translating to a minimum e-frequency of 15.29 Hz (for a standard 14-pole motor with 7 pole-pairs, this represents a mechanical rotation frequency of 2.18 Hz).
§EDT Interpretation
When parsed as an EDT frame, the 16-bit word uses the layout:
ttt0 dddd dddd cccct: 3-bit data type identifier (ie, 1 for Temperature, 2 for Voltage, etc)0: Static zero bit (forces the 4-bit prefix to evaluate as an even number)d: 8-bit sensor data payloadc: 4-bit inverted XOR checksum
§Differentiating Frames via the Prefix
The framework determines whether a packet represents an eRPM or EDT sequence by
inspecting the highest 4 bits of the 16-bit word (bits 12–15), known as the prefix:
pppp xxxx xxxx ccccThis strategy capitalizes on GCR encoding redundancies, where a given commutation period
can mathematically be written in multiple ways. To prevent collisions, the ESC normalizes
eRPM values to guarantee an odd or zero prefix pattern.
- It is an
eRPMframe if: The lower bit of the prefix is 1 (odd prefix), or the prefix evaluates to 0. - It is an
EDTframe if: The prefix evaluates to a non-zero, even number (meaning its lower bit is 0).
Implementations§
Source§impl DshotTelemetryFrame
impl DshotTelemetryFrame
pub const fn from_raw_12(raw_12: u16) -> Self
Sourcepub fn try_from_raw_16(raw_16: u16) -> Result<Self, DshotError>
pub fn try_from_raw_16(raw_16: u16) -> Result<Self, DshotError>
§Errors
pub const fn raw_16(self) -> u16
pub const fn calculate_checksum(raw_12: u16) -> u16
pub const fn checksum(self) -> u16
Sourcepub const fn checksum_is_ok(self) -> bool
pub const fn checksum_is_ok(self) -> bool
Check if checksum is ok (XOR of all 4 nibbles must equal 0x0F).
pub const fn from_exponent_mantissa(exponent: u16, mantissa: u16) -> Self
pub fn from_type_value(data_type: u8, value: u8) -> Self
pub const fn mantissa(self) -> u16
pub const fn exponent(self) -> u16
pub fn erpm(self) -> u32
pub fn erpm_f32(self) -> f32
Sourcepub const fn is_erpm_frame(self) -> bool
pub const fn is_erpm_frame(self) -> bool
Helper method to safely identify whether the frame contains eRPM or EDT data.
Sourcepub fn try_decode_erpm(self) -> Result<u32, DshotError>
pub fn try_decode_erpm(self) -> Result<u32, DshotError>
§Errors
Sourcepub fn try_decode_telemetry(self) -> Result<Telemetry, DshotError>
pub fn try_decode_telemetry(self) -> Result<Telemetry, DshotError>
§Errors
Trait Implementations§
Source§impl Clone for DshotTelemetryFrame
impl Clone for DshotTelemetryFrame
Source§fn clone(&self) -> DshotTelemetryFrame
fn clone(&self) -> DshotTelemetryFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more