Skip to content

Commit

Permalink
Fix checking address on I2C transaction start/end
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed Jul 27, 2024
1 parent 6b69d2f commit de91a3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed

- Check address in I2C transaction start/end operations. (#121)

### Changed


Expand Down
8 changes: 8 additions & 0 deletions src/eh1/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ impl I2c for Mock {
Mode::TransactionStart,
"i2c::transaction_start unexpected mode"
);
assert_eq!(
w.expected_addr, address,
"i2c::transaction_start address mismatch"
);

for op in operations {
match op {
Expand All @@ -282,6 +286,10 @@ impl I2c for Mock {
Mode::TransactionEnd,
"i2c::transaction_end unexpected mode"
);
assert_eq!(
w.expected_addr, address,
"i2c::transaction_end address mismatch"
);

Ok(())
}
Expand Down

0 comments on commit de91a3c

Please sign in to comment.