diff --git a/embassy-traits/src/i2c.rs b/embassy-traits/src/i2c.rs index e426a00b0..0fdf50a12 100644 --- a/embassy-traits/src/i2c.rs +++ b/embassy-traits/src/i2c.rs @@ -171,3 +171,22 @@ pub trait I2c { buffer: &'a mut [u8], ) -> Self::WriteReadFuture<'a>; } + +pub trait WriteIter { + /// Error type + type Error; + + type WriteIterFuture<'a, V>: Future> + 'a + where + V: 'a + IntoIterator, + Self: 'a; + + /// Sends bytes to slave with address `address` + /// + /// # I2C Events (contract) + /// + /// Same as `I2c::write` + fn write_iter<'a, U>(&'a mut self, address: A, bytes: U) -> Self::WriteIterFuture<'a, U> + where + U: IntoIterator + 'a; +}