Skip to main content

ErpmTelemetry

Struct ErpmTelemetry 

Source
pub struct ErpmTelemetry { /* private fields */ }
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]

Implementations§

Source§

impl ErpmTelemetry

Source

pub fn shift(&self) -> u8

Returns the 3-bit shift value (0-7).

Source

pub fn period_base(&self) -> u16

Returns the 9-bit period base (0-511).

Source

pub fn crc(&self) -> u8

Returns the 4-bit CRC.

Source

pub fn set_shift(&mut self, shift: u8)

Sets the 3-bit shift value (0-7). Recalculates the CRC accordingly.

§Panics

Panics if the shift value is out of bounds (> 7).

Source

pub fn set_period_base(&mut self, period_base: u16)

Sets the 9-bit period-base (0-511). Recalculates the CRC accordingly.

§Panics

Panics if the period base is out of bounds (> 511).

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) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for ErpmTelemetry

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: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.