Struct md22::Md22 [−][src]
MD22 Driver
Implementations
impl<I2C, E> Md22<I2C> where
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
[src]
I2C: WriteRead<Error = E> + Write<Error = E>,
E: Debug,
pub fn new(
i2c: I2C,
mode: OperatingMode,
address: I2CAddressSwitchState
) -> Result<Self, E>
[src]
i2c: I2C,
mode: OperatingMode,
address: I2CAddressSwitchState
) -> Result<Self, E>
Create a new MD22 driver from the given I2C peripheral and mode.
Defaults the speed, acceleration, and turn registers to 0.
pub fn set_mode(&mut self, mode: OperatingMode) -> Result<(), E>
[src]
Set the operating mode.
pub fn set_speed(&mut self, speed: u8) -> Result<(), E>
[src]
Set the motor speed register to the specified value.
pub fn set_turn(&mut self, turn: u8) -> Result<(), E>
[src]
Set the motor turn register to the specified value.
pub fn set_acceleration(&mut self, acceleration: u8) -> Result<(), E>
[src]
Set the motor acceleration register to the specified value.
The acceleration time is given by this value * 64us * n_steps.
pub fn get_software_revision(&mut self) -> Result<u8, E>
[src]
Auto Trait Implementations
impl<I2C> RefUnwindSafe for Md22<I2C> where
I2C: RefUnwindSafe,
[src]
I2C: RefUnwindSafe,
impl<I2C> Send for Md22<I2C> where
I2C: Send,
[src]
I2C: Send,
impl<I2C> Sync for Md22<I2C> where
I2C: Sync,
[src]
I2C: Sync,
impl<I2C> Unpin for Md22<I2C> where
I2C: Unpin,
[src]
I2C: Unpin,
impl<I2C> UnwindSafe for Md22<I2C> where
I2C: UnwindSafe,
[src]
I2C: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,