1477: embassy-embedded-hal: Add i2c transaction to I2cDevice r=Dirbaio a=CBJamo

Not sure why this was a todo before, but this seems to be working fine in my limited testing.

Co-authored-by: Caleb Jamison <caleb@hellbender.com>
This commit is contained in:
bors[bot] 2023-05-23 09:20:44 +00:00 committed by GitHub
commit 627d7f66ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,9 +84,11 @@ where
address: u8, address: u8,
operations: &mut [embedded_hal_async::i2c::Operation<'_>], operations: &mut [embedded_hal_async::i2c::Operation<'_>],
) -> Result<(), I2cDeviceError<BUS::Error>> { ) -> Result<(), I2cDeviceError<BUS::Error>> {
let _ = address; let mut bus = self.bus.lock().await;
let _ = operations; bus.transaction(address, operations)
todo!() .await
.map_err(I2cDeviceError::I2c)?;
Ok(())
} }
} }
@ -150,8 +152,11 @@ where
} }
async fn transaction(&mut self, address: u8, operations: &mut [i2c::Operation<'_>]) -> Result<(), Self::Error> { async fn transaction(&mut self, address: u8, operations: &mut [i2c::Operation<'_>]) -> Result<(), Self::Error> {
let _ = address; let mut bus = self.bus.lock().await;
let _ = operations; bus.set_config(&self.config);
todo!() bus.transaction(address, operations)
.await
.map_err(I2cDeviceError::I2c)?;
Ok(())
} }
} }