diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index b4036f207..4fe4b27eb 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs @@ -294,13 +294,24 @@ impl<'d, T: Instance> I2c<'d, T, Async> { pub async fn read_async(&mut self, addr: u16, buffer: &mut [u8]) -> Result<(), Error> { Self::setup(addr)?; - self.read_async_internal(buffer, false, true).await + self.read_async_internal(buffer, true, true).await } pub async fn write_async(&mut self, addr: u16, bytes: impl IntoIterator) -> Result<(), Error> { Self::setup(addr)?; self.write_async_internal(bytes, true).await } + + pub async fn write_read_async( + &mut self, + addr: u16, + bytes: impl IntoIterator, + buffer: &mut [u8], + ) -> Result<(), Error> { + Self::setup(addr)?; + self.write_async_internal(bytes, false).await?; + self.read_async_internal(buffer, true, true).await + } } pub struct InterruptHandler { @@ -713,7 +724,7 @@ mod nightly { Self::setup(addr)?; self.write_async_internal(write.iter().cloned(), false).await?; - self.read_async_internal(read, false, true).await + self.read_async_internal(read, true, true).await } async fn transaction(&mut self, address: A, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {