mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-23 09:46:33 +11:00
Fix i2c write read (#146)
* i2c write_read: don't continue with read if write aborted * i2c write_read: use correct length of read buffer
This commit is contained in:
parent
800f71a1b8
commit
ad68c9d696
1 changed files with 6 additions and 1 deletions
|
@ -383,9 +383,14 @@ macro_rules! hal {
|
|||
}
|
||||
}
|
||||
|
||||
if abort {
|
||||
return Err(Error::Abort(abort_reason));
|
||||
}
|
||||
|
||||
let buffer_len = buffer.len();
|
||||
for (i, byte) in buffer.iter_mut().enumerate() {
|
||||
let first = i == 0;
|
||||
let last = i == bytes.len() - 1;
|
||||
let last = i == buffer_len - 1;
|
||||
|
||||
// wait until there is space in the FIFO to write the next byte
|
||||
while self.tx_fifo_full() {}
|
||||
|
|
Loading…
Add table
Reference in a new issue