i2c: fix comments

fix/i2c-race
Harry Ho 2021-07-13 15:14:53 +08:00
parent 91445620ee
commit 88bda0cb7a
1 changed files with 4 additions and 4 deletions

View File

@ -190,7 +190,7 @@ impl I2c {
self.scl_oe(false);
self.half_period();
self.scl_oe(true);
while self.scl_i() {} // ensure SCL is low before start() returns
while self.scl_i() {} // ensure SCL is low before toggling SDA
}
self.sda_oe(false);
self.half_period();
@ -199,7 +199,7 @@ impl I2c {
// Read ack/nack
let ack = !self.sda_i();
self.scl_oe(true);
while self.scl_i() {} // ensure SCL is low before start() returns
while self.scl_i() {} // ensure SCL is low before toggling SDA
self.sda_oe(true);
// postcondition: SCL and SDA low
@ -219,7 +219,7 @@ impl I2c {
self.half_period();
if self.sda_i() { data |= 1 << bit }
self.scl_oe(true);
while self.scl_i() {} // ensure SCL is low before start() returns
while self.scl_i() {} // ensure SCL is low so that slave can toggle SDA
}
// Send ack/nack
self.sda_oe(ack);
@ -227,7 +227,7 @@ impl I2c {
self.scl_oe(false);
self.half_period();
self.scl_oe(true);
while self.scl_i() {} // ensure SCL is low before start() returns
while self.scl_i() {} // ensure SCL is low before toggling SDA
self.sda_oe(true);
// postcondition: SCL and SDA low