diff --git a/rp2040-hal/src/i2c/controller.rs b/rp2040-hal/src/i2c/controller.rs index cf11bed43..cd084929c 100644 --- a/rp2040-hal/src/i2c/controller.rs +++ b/rp2040-hal/src/i2c/controller.rs @@ -1,5 +1,5 @@ use core::{marker::PhantomData, ops::Deref}; -use embedded_hal::blocking::i2c::{Read, Write, WriteRead}; +use embedded_hal::blocking::i2c::{Read, Write, WriteIter, WriteIterRead, WriteRead}; use fugit::HertzU32; #[cfg(feature = "eh1_0_alpha")] @@ -335,6 +335,7 @@ impl, PINS> WriteRead for I2C { self.read_internal(rx, true, true) } } + impl, PINS> Write for I2C { type Error = Error; @@ -347,6 +348,33 @@ impl, PINS> Write for I2C { } } +impl, PINS> WriteIter for I2C { + type Error = Error; + + fn write(&mut self, address: u8, bytes: B) -> Result<(), Self::Error> + where + B: IntoIterator, + { + self.write_iter(address, bytes) + } +} + +impl, PINS> WriteIterRead for I2C { + type Error = Error; + + fn write_iter_read( + &mut self, + address: u8, + bytes: B, + buffer: &mut [u8], + ) -> Result<(), Self::Error> + where + B: IntoIterator, + { + self.write_iter_read(address, bytes, buffer) + } +} + #[cfg(feature = "eh1_0_alpha")] impl, PINS> eh1::ErrorType for I2C { type Error = Error;