Struct esp_idf_hal::i2c::I2cDriver
source · pub struct I2cDriver<'d> { /* private fields */ }
Implementations§
source§impl<'d> I2cDriver<'d>
impl<'d> I2cDriver<'d>
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>
pub fn read( &mut self, addr: u8, buffer: &mut [u8], timeout: TickType_t, ) -> Result<(), EspError>
pub fn write( &mut self, addr: u8, bytes: &[u8], timeout: TickType_t, ) -> Result<(), EspError>
pub fn write_read( &mut self, addr: u8, bytes: &[u8], buffer: &mut [u8], timeout: TickType_t, ) -> Result<(), EspError>
pub fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], timeout: TickType_t, ) -> Result<(), EspError>
pub fn port(&self) -> i2c_port_t
Trait Implementations§
source§impl<'d> I2c for I2cDriver<'d>
impl<'d> I2c for I2cDriver<'d>
source§fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address
. Read moresource§fn write_read(
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8],
) -> Result<(), Self::Error>
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