Struct esp_idf_hal::i2c::I2cDriver

source ·
pub struct I2cDriver<'d> { /* private fields */ }

Implementations§

source§

impl<'d> I2cDriver<'d>

source

pub fn new<I2C: I2c>( _i2c: impl Peripheral<P = I2C> + 'd, sda: impl Peripheral<P = impl InputPin + OutputPin> + 'd, scl: impl Peripheral<P = impl InputPin + OutputPin> + 'd, config: &Config, ) -> Result<Self, EspError>

source

pub fn read( &mut self, addr: u8, buffer: &mut [u8], timeout: TickType_t, ) -> Result<(), EspError>

source

pub fn write( &mut self, addr: u8, bytes: &[u8], timeout: TickType_t, ) -> Result<(), EspError>

source

pub fn write_read( &mut self, addr: u8, bytes: &[u8], buffer: &mut [u8], timeout: TickType_t, ) -> Result<(), EspError>

source

pub fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], timeout: TickType_t, ) -> Result<(), EspError>

source

pub fn port(&self) -> i2c_port_t

Trait Implementations§

source§

impl<'d> Drop for I2cDriver<'d>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'d> ErrorType for I2cDriver<'d>

§

type Error = I2cError

Error type
source§

impl<'d> I2c for I2cDriver<'d>

source§

fn read(&mut self, addr: u8, buffer: &mut [u8]) -> Result<(), Self::Error>

Reads enough bytes from slave with address to fill read. Read more
source§

fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error>

Writes bytes to slave with address address. Read more
source§

fn write_read( &mut self, addr: u8, bytes: &[u8], buffer: &mut [u8], ) -> Result<(), Self::Error>

Writes bytes to slave with address address and then reads enough bytes to fill read in a single transaction. Read more
source§

fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus. Read more
source§

impl<'d> Read for I2cDriver<'d>

§

type Error = I2cError

Error type
source§

fn read(&mut self, addr: u8, buffer: &mut [u8]) -> Result<(), Self::Error>

Reads enough bytes from slave with address to fill buffer Read more
source§

impl<'d> Write for I2cDriver<'d>

§

type Error = I2cError

Error type
source§

fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error>

Writes bytes to slave with address address Read more
source§

impl<'d> WriteRead for I2cDriver<'d>

§

type Error = I2cError

Error type
source§

fn write_read( &mut self, addr: u8, bytes: &[u8], buffer: &mut [u8], ) -> Result<(), Self::Error>

Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction Read more
source§

impl<'d> Send for I2cDriver<'d>

Auto Trait Implementations§

§

impl<'d> Freeze for I2cDriver<'d>

§

impl<'d> RefUnwindSafe for I2cDriver<'d>

§

impl<'d> Sync for I2cDriver<'d>

§

impl<'d> Unpin for I2cDriver<'d>

§

impl<'d> !UnwindSafe for I2cDriver<'d>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.