aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src
diff options
context:
space:
mode:
authorSebastian Goll <[email protected]>2024-03-20 01:12:04 +0100
committerSebastian Goll <[email protected]>2024-03-20 01:12:04 +0100
commitd65724207d7f0cb65e60966982ef671f57986abf (patch)
tree997e7099a520eff005dcb71de9350175534e67fc /embassy-embedded-hal/src
parent7bf4710f3fd89879eca6ca24ffdbd75c859971be (diff)
Forward transaction() from blocking I2cDevice to underlying bus
Diffstat (limited to 'embassy-embedded-hal/src')
-rw-r--r--embassy-embedded-hal/src/shared_bus/blocking/i2c.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
index 233c9e1fd..1b08cb28e 100644
--- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
+++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
@@ -67,9 +67,11 @@ where
67 } 67 }
68 68
69 fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> { 69 fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
70 let _ = address; 70 self.bus.lock(|bus| {
71 let _ = operations; 71 bus.borrow_mut()
72 todo!() 72 .transaction(address, operations)
73 .map_err(I2cDeviceError::I2c)
74 })
73 } 75 }
74} 76}
75 77
@@ -171,8 +173,10 @@ where
171 } 173 }
172 174
173 fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> { 175 fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
174 let _ = address; 176 self.bus.lock(|bus| {
175 let _ = operations; 177 let mut bus = bus.borrow_mut();
176 todo!() 178 bus.set_config(&self.config).map_err(|_| I2cDeviceError::Config)?;
179 bus.transaction(address, operations).map_err(I2cDeviceError::I2c)
180 })
177 } 181 }
178} 182}