We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 910163d + b5be7ac commit a181da1Copy full SHA for a181da1
src/i2c.rs
@@ -344,7 +344,7 @@ impl<I2C: Instance> I2c<I2C> {
344
Address::Seven(addr) => {
345
self.i2c
346
.dr()
347
- .write(|w| unsafe { w.bits((u32::from(addr) << 1) & 1) });
+ .write(|w| unsafe { w.bits((u32::from(addr) << 1) | 1) });
348
}
349
Address::Ten(addr) => {
350
let [msbs, lsbs] = addr.to_be_bytes();
@@ -357,7 +357,7 @@ impl<I2C: Instance> I2c<I2C> {
357
self.i2c.cr1().modify(|_, w| w.start().set_bit());
358
// Wait until START condition was generated
359
while self.i2c.sr1().read().sb().bit_is_clear() {}
360
- dr.write(|w| unsafe { w.bits(u32::from(msbs & 1)) });
+ dr.write(|w| unsafe { w.bits(u32::from(msbs | 1)) });
361
362
363
0 commit comments