pub struct Frame<P: DshotProtocol = NormalDshot> { /* private fields */ }Expand description
A DShot frame parameterized by its protocol variant.
Implementations§
Source§impl<P: DshotProtocol> Frame<P>
impl<P: DshotProtocol> Frame<P>
Sourcepub fn new(speed: u16, request_telemetry: bool) -> Option<Self>
pub fn new(speed: u16, request_telemetry: bool) -> Option<Self>
Creates a new frame with the given speed (0-1999) and telemetry request.
Returns None if the speed is out of bounds.
assert_eq!(Frame::<NormalDshot>::new(1000, false).unwrap().speed(), 1000);Sourcepub fn command(command: Command, request_telemetry: bool) -> Self
pub fn command(command: Command, request_telemetry: bool) -> Self
Creates a new frame with the given Command and telemetry request.
Sourcepub fn telemetry_enabled(&self) -> bool
pub fn telemetry_enabled(&self) -> bool
Returns whether telemetry is enabled.
Sourcepub fn duty_cycles(&self, max_duty_cycle: u16) -> [u16; 17]
pub fn duty_cycles(&self, max_duty_cycle: u16) -> [u16; 17]
Returns an array of duty cycles for use in PWM DMA.
This contains an extra element that is always zero to ensure the PWM output gets pulled low at the end of the sequence. It can be sliced off if not needed.
Trait Implementations§
impl<P: Copy + DshotProtocol> Copy for Frame<P>
Auto Trait Implementations§
impl<P> Freeze for Frame<P>
impl<P> RefUnwindSafe for Frame<P>where
P: RefUnwindSafe,
impl<P> Send for Frame<P>where
P: Send,
impl<P> Sync for Frame<P>where
P: Sync,
impl<P> Unpin for Frame<P>where
P: Unpin,
impl<P> UnwindSafe for Frame<P>where
P: UnwindSafe,
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