Trait embedded_hal::blocking::i2c::Read
source · pub trait Read<A: AddressMode = SevenBitAddress> {
type Error;
// Required method
fn read(&mut self, address: A, buffer: &mut [u8]) -> Result<(), Self::Error>;
}
Expand description
Blocking read
Required Associated Types§
Required Methods§
sourcefn read(&mut self, address: A, buffer: &mut [u8]) -> Result<(), Self::Error>
fn read(&mut self, address: A, buffer: &mut [u8]) -> Result<(), Self::Error>
Reads enough bytes from slave with address
to fill buffer
§I2C Events (contract)
Master: ST SAD+R MAK MAK ... NMAK SP
Slave: SAK B0 B1 ... BN
Where
ST
= start conditionSAD+R
= slave address followed by bit 1 to indicate readingSAK
= slave acknowledgeBi
= ith byte of dataMAK
= master acknowledgeNMAK
= master no acknowledgeSP
= stop condition