Skip to content

Commit

Permalink
Merge pull request #98 from hlukasz/master
Browse files Browse the repository at this point in the history
i2c: properly handle bus errors
  • Loading branch information
hannobraun committed May 29, 2020
2 parents 3a9b3e4 + e263084 commit 46b50b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ where
}

fn start_transfer(&mut self, addr: u8, len: usize, direction: RD_WRN_A, autoend : AUTOEND_A) {
// Ensure that TX/RX buffers are empty
self.i2c.isr.write(|w| w.txe().set_bit());
while self.i2c.isr.read().rxne().bit_is_set() {
self.i2c.rxdr.read();
};

self.i2c.cr2.write(|w|
w
// Start transfer
Expand Down

0 comments on commit 46b50b5

Please sign in to comment.