diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-05-23 09:20:44 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-23 09:20:44 +0000 |
| commit | 627d7f66efb7ff3dcf627477814c52ba4171bade (patch) | |
| tree | 49ca4683d723a5d45a506c577329903ed7e95eb7 /embassy-embedded-hal | |
| parent | 1fdde8f03fc8b98c7fdb91a94e2dfd47bcbc24cb (diff) | |
| parent | 3ad52f837d865d4b6728e58223b944d9e37a6ddf (diff) | |
Merge #1477
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 <[email protected]>
Diffstat (limited to 'embassy-embedded-hal')
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/asynch/i2c.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs index 829554045..87e8a4304 100644 --- a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs | |||
| @@ -84,9 +84,11 @@ where | |||
| 84 | address: u8, | 84 | address: u8, |
| 85 | operations: &mut [embedded_hal_async::i2c::Operation<'_>], | 85 | operations: &mut [embedded_hal_async::i2c::Operation<'_>], |
| 86 | ) -> Result<(), I2cDeviceError<BUS::Error>> { | 86 | ) -> Result<(), I2cDeviceError<BUS::Error>> { |
| 87 | let _ = address; | 87 | let mut bus = self.bus.lock().await; |
| 88 | let _ = operations; | 88 | bus.transaction(address, operations) |
| 89 | todo!() | 89 | .await |
| 90 | .map_err(I2cDeviceError::I2c)?; | ||
| 91 | Ok(()) | ||
| 90 | } | 92 | } |
| 91 | } | 93 | } |
| 92 | 94 | ||
| @@ -150,8 +152,11 @@ where | |||
| 150 | } | 152 | } |
| 151 | 153 | ||
| 152 | async fn transaction(&mut self, address: u8, operations: &mut [i2c::Operation<'_>]) -> Result<(), Self::Error> { | 154 | async fn transaction(&mut self, address: u8, operations: &mut [i2c::Operation<'_>]) -> Result<(), Self::Error> { |
| 153 | let _ = address; | 155 | let mut bus = self.bus.lock().await; |
| 154 | let _ = operations; | 156 | bus.set_config(&self.config); |
| 155 | todo!() | 157 | bus.transaction(address, operations) |
| 158 | .await | ||
| 159 | .map_err(I2cDeviceError::I2c)?; | ||
| 160 | Ok(()) | ||
| 156 | } | 161 | } |
| 157 | } | 162 | } |
