Skip to content

Commit

Permalink
Merge pull request #402 from nkrackow/nk/i2c-fix
Browse files Browse the repository at this point in the history
Bugfix for I2C transaction stop conditions
  • Loading branch information
ryan-summers authored Nov 4, 2022
2 parents 21d9c06 + edf9dd5 commit b8170b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

* i2c: Fix stop condition not awaited bug [#402]

## [v0.13.0] 2022-10-06

* **Breaking** Require frequency when initialising adc, use this to set the prescaler [#379]
Expand Down
9 changes: 7 additions & 2 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ macro_rules! i2c {
// Stop
self.master_stop();

// Wait for stop
busy_wait!(self.i2c, busy, is_not_busy);

Ok(())
}
}
Expand Down Expand Up @@ -631,7 +634,8 @@ macro_rules! i2c {
*byte = self.i2c.rxdr.read().rxdata().bits();
}

// automatic STOP
// Wait for automatic stop
busy_wait!(self.i2c, busy, is_not_busy);

Ok(())
}
Expand All @@ -657,7 +661,8 @@ macro_rules! i2c {
*byte = self.i2c.rxdr.read().rxdata().bits();
}

// automatic STOP
// Wait for automatic stop
busy_wait!(self.i2c, busy, is_not_busy);

Ok(())
}
Expand Down

0 comments on commit b8170b5

Please sign in to comment.