diff --git a/src/proxies.rs b/src/proxies.rs index 124ff63..d154ada 100644 --- a/src/proxies.rs +++ b/src/proxies.rs @@ -64,6 +64,40 @@ where } } +impl<'a, M: crate::BusMutex> i2c::WriteIterRead for I2cProxy<'a, M> +where + M::Bus: i2c::WriteIterRead, +{ + type Error = ::Error; + + fn write_iter_read( + &mut self, + address: u8, + bytes: B, + buffer: &mut [u8], + ) -> Result<(), Self::Error> + where + B: IntoIterator, + { + self.mutex + .lock(|bus| bus.write_iter_read(address, bytes, buffer)) + } +} + +impl<'a, M: crate::BusMutex> i2c::WriteIter for I2cProxy<'a, M> +where + M::Bus: i2c::WriteIter, +{ + type Error = ::Error; + + fn write(&mut self, address: u8, bytes: B) -> Result<(), Self::Error> + where + B: IntoIterator, + { + self.mutex.lock(|bus| bus.write(address, bytes)) + } +} + // Implementations for the embedded_hal alpha #[cfg(feature = "eh-alpha")]