Struct esp_idf_svc::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: impl Peripheral<P = I2C> + 'd,
sda: impl Peripheral<P = impl InputPin + OutputPin> + 'd,
scl: impl Peripheral<P = impl InputPin + OutputPin> + 'd,
config: &Config,
) -> Result<I2cDriver<'d>, EspError>where
I2C: I2c,
pub fn read( &mut self, addr: u8, buffer: &mut [u8], timeout: u32, ) -> Result<(), EspError>
pub fn write( &mut self, addr: u8, bytes: &[u8], timeout: u32, ) -> Result<(), EspError>
pub fn write_read( &mut self, addr: u8, bytes: &[u8], buffer: &mut [u8], timeout: u32, ) -> Result<(), EspError>
pub fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], timeout: u32, ) -> Result<(), EspError>
pub fn port(&self) -> u32
Trait Implementations§
source§impl<'d> I2c for I2cDriver<'d>
impl<'d> I2c for I2cDriver<'d>
source§fn read(
&mut self,
addr: u8,
buffer: &mut [u8],
) -> Result<(), <I2cDriver<'d> as ErrorType>::Error>
fn read( &mut self, addr: u8, buffer: &mut [u8], ) -> Result<(), <I2cDriver<'d> as ErrorType>::Error>
source§fn write(
&mut self,
addr: u8,
bytes: &[u8],
) -> Result<(), <I2cDriver<'d> as ErrorType>::Error>
fn write( &mut self, addr: u8, bytes: &[u8], ) -> Result<(), <I2cDriver<'d> as ErrorType>::Error>
Writes bytes to slave with address
address
. Read more