Struct I2cDev

Source
pub struct I2cDev<I>(pub I);
Expand description

A wrapper around an I2CDevice type that impls the i2c traits.

This is required due to Rust’s orphan rules.

Tuple Fields§

§0: I

Trait Implementations§

Source§

impl Address for I2cDev<LinuxI2CDevice>

Source§

fn set_slave_address( &mut self, addr: u16, tenbit: bool, ) -> Result<(), Self::Error>

Sets the current slave to address. Read more
Source§

impl<I: I2CDevice> BlockTransfer for I2cDev<I>

Source§

fn i2c_read_block_data( &mut self, command: u8, value: &mut [u8], ) -> Result<usize, Self::Error>

Reads a block of bytes from the designated device register. Read more
Source§

fn i2c_write_block_data( &mut self, command: u8, value: &[u8], ) -> Result<(), Self::Error>

Writes a block of bytes to the designated device register. Read more
Source§

impl<I: I2CDevice> Master for I2cDev<I>

Source§

type Error = <I as I2CDevice>::Error

The error type returned by I2C operations.
Source§

impl<I: I2CDevice> ReadWrite for I2cDev<I>

Source§

fn i2c_read(&mut self, value: &mut [u8]) -> Result<usize, Self::Error>

Initiate an isolated read transfer on the I2C bus, followed by a STOP.
Source§

fn i2c_write(&mut self, value: &[u8]) -> Result<(), Self::Error>

Initiate an isolated write transfer on the I2C bus, followed by a STOP.
Source§

impl<I: I2CDevice> Smbus for I2cDev<I>

Source§

fn smbus_write_quick(&mut self, value: bool) -> Result<(), Self::Error>

Sends a single bit to the device, in the place of the rd/wr address bit.
Source§

fn smbus_read_byte(&mut self) -> Result<u8, Self::Error>

Reads a single byte from a device without specifying a register.
Source§

fn smbus_write_byte(&mut self, value: u8) -> Result<(), Self::Error>

Sends a single byte to the device
Source§

fn smbus_read_byte_data(&mut self, command: u8) -> Result<u8, Self::Error>

Reads a byte from the designated register.
Source§

fn smbus_write_byte_data( &mut self, command: u8, value: u8, ) -> Result<(), Self::Error>

Writes a byte to the designated register.
Source§

fn smbus_read_word_data(&mut self, command: u8) -> Result<u16, Self::Error>

Reads a 16-bit word from the designated register.
Source§

fn smbus_write_word_data( &mut self, command: u8, value: u16, ) -> Result<(), Self::Error>

Writes a 16-bit word to the designated register.
Source§

fn smbus_process_call( &mut self, command: u8, value: u16, ) -> Result<u16, Self::Error>

Writes a 16-bit word to the specified register, then reads a 16-bit word in response.
Source§

fn smbus_read_block_data( &mut self, command: u8, value: &mut [u8], ) -> Result<usize, Self::Error>

Reads up to 32 bytes from the designated device register. Read more
Source§

fn smbus_write_block_data( &mut self, command: u8, value: &[u8], ) -> Result<(), Self::Error>

Writes up to 32 bytes to the designated device register.
Source§

impl<I: I2CDevice> Smbus20 for I2cDev<I>

Source§

fn smbus_process_call_block( &mut self, command: u8, write: &[u8], read: &mut [u8], ) -> Result<usize, Self::Error>

Sends up to 31 bytes of data to the designated register, and reads up to 31 bytes in return. Read more

Auto Trait Implementations§

§

impl<I> Freeze for I2cDev<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for I2cDev<I>
where I: RefUnwindSafe,

§

impl<I> Send for I2cDev<I>
where I: Send,

§

impl<I> Sync for I2cDev<I>
where I: Sync,

§

impl<I> Unpin for I2cDev<I>
where I: Unpin,

§

impl<I> UnwindSafe for I2cDev<I>
where I: 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.