pub struct Driver { /* private fields */ }Expand description
The core object in the API. Represents a single motor.
Has a Default impl which uses the default address, but if you want to stack them on a bus you
should use with_id.
Implementations§
Source§impl Driver
impl Driver
Sourcepub fn rotate<'a>(
&'a mut self,
direction: Direction,
speed: u8,
) -> Result<&'a [u8], Error>
pub fn rotate<'a>( &'a mut self, direction: Direction, speed: u8, ) -> Result<&'a [u8], Error>
Start the motor rotating.
It will continue doing this until stopped. Direction is relative to the configured direction in the motor.
Speed is a value between 0 and 0x80. The values can be calculated with more infomration about how the motor is configured but that’s not implemented.
pub fn rotate_to<'a>( &'a mut self, direction: Direction, speed: u8, value: u32, ) -> Result<&'a [u8], Error>
pub fn zero<'a>(&'a mut self) -> Result<&'a [u8], Error>
pub fn set_zero_speed<'a>(&'a mut self, speed: u8) -> Result<&'a [u8], Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Driver
impl RefUnwindSafe for Driver
impl Send for Driver
impl Sync for Driver
impl Unpin for Driver
impl UnwindSafe for Driver
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