mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Add i2c transaction
This commit is contained in:
parent
ab7d129e15
commit
49eaf000b8
@ -84,9 +84,13 @@ 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;
|
defmt::info!("lock");
|
||||||
let _ = operations;
|
let mut bus = self.bus.lock().await;
|
||||||
todo!()
|
defmt::info!("transact");
|
||||||
|
bus.transaction(address, operations)
|
||||||
|
.await
|
||||||
|
.map_err(I2cDeviceError::I2c)?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,8 +154,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(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user