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
impl ErpmTelemetry
Sourcepub fn period_base(&self) -> u16
pub fn period_base(&self) -> u16
Returns the 9-bit period base (0-511).
Sourcepub fn set_shift(&mut self, shift: u8)
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).
Sourcepub fn set_period_base(&mut self, period_base: u16)
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).
Sourcepub fn try_from_raw(raw: u16) -> Option<Self>
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.
Sourcepub fn period_us(&self) -> Option<u32>
pub fn period_us(&self) -> Option<u32>
Returns the period in microseconds.
If period_base is zero, the period is considered infinite (motor stopped).
Trait Implementations§
Source§impl Clone for ErpmTelemetry
impl Clone for ErpmTelemetry
impl Copy for ErpmTelemetry
Source§impl Debug for ErpmTelemetry
impl Debug for ErpmTelemetry
Source§impl PartialEq for ErpmTelemetry
impl PartialEq for ErpmTelemetry
impl StructuralPartialEq for ErpmTelemetry
Auto Trait Implementations§
impl Freeze for ErpmTelemetry
impl RefUnwindSafe for ErpmTelemetry
impl Send for ErpmTelemetry
impl Sync for ErpmTelemetry
impl Unpin for ErpmTelemetry
impl UnsafeUnpin for ErpmTelemetry
impl UnwindSafe for ErpmTelemetry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more