From 7840d0f8333d7a9a6dd0f07389d1d73c11caf97b Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Tue, 11 Jan 2022 12:40:57 +0000 Subject: [PATCH] embassy-traits: Fix unexpected restart on repeated read. --- rp2040-hal/src/i2c/controller/embassy_support.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rp2040-hal/src/i2c/controller/embassy_support.rs b/rp2040-hal/src/i2c/controller/embassy_support.rs index e1e81eb..4bfb2f1 100644 --- a/rp2040-hal/src/i2c/controller/embassy_support.rs +++ b/rp2040-hal/src/i2c/controller/embassy_support.rs @@ -7,7 +7,7 @@ impl, PINS> I2C { &mut self, mut buffer: Peekable, ) -> Result<(), Error> { - let first = true; + let mut first = true; while let Some(byte) = buffer.next() { let last = buffer.peek().is_none(); @@ -24,6 +24,7 @@ impl, PINS> I2C { self.i2c.ic_data_cmd.write(|w| { if first { w.restart().enable(); + first = false; } else { w.restart().disable(); }