ErpmTelemetry

Struct ErpmTelemetry 

Source
pub struct ErpmTelemetry {
    pub shift: u8,
    pub period_base: u16,
    pub crc: u8,
}
Expand description

eRPM telemetry frame as sent by ESC in bidirectional DShot mode.

Despite being used in bidirectional mode, this frame is not inverted, and its CRC is computed using the standard (non-inverted) DShot algorithm.

Format (16 bits): [3-bit shift][9-bit period_base][4-bit CRC]

Fields§

§shift: u8

Raw 3-bit shift value (0–7)

§period_base: u16

Raw 9-bit period base (0–511)

§crc: u8

Raw 4-bit CRC (for debugging)

Implementations§

Source§

impl ErpmTelemetry

Source

pub fn try_from_raw(raw: u16) -> Option<Self>

Attempts to parse a 16-bit raw telemetry value.

Returns None if the CRC is invalid.

Source

pub fn period_us(&self) -> Option<u32>

Returns the period in microseconds.

If period_base is zero, the period is considered infinite (motor stopped).

Source

pub fn erpm(&self) -> u32

Returns the electrical RPM (eRPM).

Computed as 60_000_000 / period_us. Returns 0 if the motor is stopped (period_base == 0).

Source

pub fn to_raw(&self) -> u16

Returns the raw 16-bit value (for logging or retransmission).

Trait Implementations§

Source§

impl Clone for ErpmTelemetry

Source§

fn clone(&self) -> ErpmTelemetry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ErpmTelemetry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ErpmTelemetry

Source§

fn eq(&self, other: &ErpmTelemetry) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ErpmTelemetry

Source§

impl StructuralPartialEq for ErpmTelemetry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.