diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2022-10-01 19:28:27 -0700 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy@goop.org> | 2022-10-01 19:28:27 -0700 |
commit | 09afece93d0dccb750a0dbc9c63282d3dca55e48 (patch) | |
tree | 1f251b595e889e8df5c118126c9741ab9b721e06 | |
parent | 1ee4bb22deb19e93a7c68e04875889e3e4e31c29 (diff) | |
download | embassy-09afece93d0dccb750a0dbc9c63282d3dca55e48.zip |
make I2c::write_async take an iterator
There's no other iterator async API right now.
-rw-r--r-- | embassy-rp/src/i2c.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index 6fc64d84..f62cf0b8 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs @@ -406,9 +406,9 @@ impl<'d, T: Instance> I2c<'d, T, Async> { self.read_async_internal(buffer, false, true).await } - pub async fn write_async(&mut self, addr: u16, buffer: &[u8]) -> Result<(), Error> { + pub async fn write_async(&mut self, addr: u16, bytes : impl IntoIterator<Item = u8>) -> Result<(), Error> { Self::setup(addr)?; - self.write_async_internal(buffer.iter().copied(), true).await + self.write_async_internal(bytes, true).await } } |