Struct BlockingI2c

Source
pub struct BlockingI2c<Bus> { /* private fields */ }
Expand description

Implement the JrkG2 trait for Blocking I2C

Implementations§

Source§

impl<Bus, I2cError> BlockingI2c<Bus>
where Bus: Write<Error = Error<I2cError>> + Read<Error = Error<I2cError>>,

Source

pub const fn new(i2c: Bus) -> Self

Source

pub fn set_device(&mut self, device: u8)

The controller have a default 0x0B I2C address, but this can be manually changed in the configuration utility.

Trait Implementations§

Source§

impl<Bus, I2cError> JrkG2<I2cError> for BlockingI2c<Bus>
where Bus: Write<Error = Error<I2cError>> + Read<Error = Error<I2cError>>,

Source§

fn write(&mut self, data: &[u8]) -> Result<(), I2cError>

Source§

fn read(&mut self, cmd: VarOffset) -> Result<u16, I2cError>

Source§

fn set_target(&mut self, target: u16) -> Result<(), ComError>

Put the motor in motion Read more
Source§

fn stop_motor(&mut self) -> Result<(), ComError>

Stop the motor
Source§

fn show_var<W: Write>( &mut self, f: &mut W, var: VarOffset, ) -> Result<(), ComError>

Print one of the internal variables of the controller to a fmt::Write implementor
Source§

fn show_vars<W: Write>(&mut self, f: &mut W) -> Result<(), ComError>

Print main internal variables of the controller to a fmt::Write implementor

Auto Trait Implementations§

§

impl<Bus> Freeze for BlockingI2c<Bus>
where Bus: Freeze,

§

impl<Bus> RefUnwindSafe for BlockingI2c<Bus>
where Bus: RefUnwindSafe,

§

impl<Bus> Send for BlockingI2c<Bus>
where Bus: Send,

§

impl<Bus> Sync for BlockingI2c<Bus>
where Bus: Sync,

§

impl<Bus> Unpin for BlockingI2c<Bus>
where Bus: Unpin,

§

impl<Bus> UnwindSafe for BlockingI2c<Bus>
where Bus: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.