diff --git a/esp-hal/src/i2c.rs b/esp-hal/src/i2c.rs index c154fa2c16..396a94baf0 100644 --- a/esp-hal/src/i2c.rs +++ b/esp-hal/src/i2c.rs @@ -926,11 +926,13 @@ mod asynch { addr, bytes, true, - false, + buffer.is_empty(), // if the read buffer is empty, then issue a stop &mut self.peripheral.register_block().comd_iter(), ) .await?; self.peripheral.clear_all_interrupts(); + // this will be a no-op if the buffer is empty, in that case we issued the stop + // with the write self.read_operation( addr, buffer, @@ -2142,10 +2144,12 @@ pub trait Instance: crate::private::Sealed { addr, bytes, true, - false, + buffer.is_empty(), // if the read buffer is empty, then issue a stop &mut self.register_block().comd_iter(), )?; self.clear_all_interrupts(); + // this will be a no-op if the buffer is empty, in that case we issued the stop + // with the write self.read_operation( addr, buffer,