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 Aug 30, 2024
1 parent 9023195 commit 46ea0a0
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 @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 46ea0a0

Please sign in to comment.