Struct ezo_i2c_rs::EzoBoard
source · [−]pub struct EzoBoard<I2C> { /* private fields */ }
Expand description
Newtype that encapsulates the I2C device and it’s address.
Implementations
sourceimpl<I2C, E> EzoBoard<I2C> where
I2C: Read<Error = E> + Write<Error = E>,
E: Error,
impl<I2C, E> EzoBoard<I2C> where
I2C: Read<Error = E> + Write<Error = E>,
E: Error,
I2C must implement the embedded-hal traits for I2C. Specifically Read
and Write
are required.
https://docs.rs/embedded-hal/0.2.4/embedded_hal/blocking/i2c/index.html
pub fn new(i2c: I2C, address: u8) -> Self
sourcepub fn send_command(
&mut self,
command: &[u8],
delay: Duration
) -> Result<(), EzoBoardError<E>>
pub fn send_command(
&mut self,
command: &[u8],
delay: Duration
) -> Result<(), EzoBoardError<E>>
Sends a command to the Ezo device and then sleep the specified delay. Does not sleep on delay if delay is Duration:new(0,0)
sourcepub fn read_response(&mut self) -> Result<String, EzoBoardError<E>>
pub fn read_response(&mut self) -> Result<String, EzoBoardError<E>>
Reads from ezo device, checks response code and returns the result as a string for convenience.
Auto Trait Implementations
impl<I2C> RefUnwindSafe for EzoBoard<I2C> where
I2C: RefUnwindSafe,
impl<I2C> Send for EzoBoard<I2C> where
I2C: Send,
impl<I2C> Sync for EzoBoard<I2C> where
I2C: Sync,
impl<I2C> Unpin for EzoBoard<I2C> where
I2C: Unpin,
impl<I2C> UnwindSafe for EzoBoard<I2C> where
I2C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more