Skip to content

Commit

Permalink
handle write_read when the read bufer is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
liebman committed Sep 4, 2024
1 parent 539aac4 commit 6c297c7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions esp-hal/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,11 +895,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,
Expand Down Expand Up @@ -2111,10 +2113,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,
Expand Down

0 comments on commit 6c297c7

Please sign in to comment.