pub struct Frame { /* private fields */ }
Expand description
A frame of two bytes that get send over the wire.
Implementations§
Source§impl Frame
impl Frame
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::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§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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