i2c_master: fix stop generation
This commit is contained in:
parent
c6a4f58b93
commit
7656c699bf
@ -210,7 +210,7 @@ enum i2c_master_rc i2c_master_stop(void)
|
||||
if (!(I2C_SR2(I2C(I2C_MASTER_I2C)) & I2C_SR2_BUSY)) { // release is not busy
|
||||
return I2C_MASTER_RC_NONE; // bus has probably already been released
|
||||
}
|
||||
if (I2C_CR1(I2C(I2C_MASTER_I2C)) & (I2C_CR1_START | I2C_CR1_STOP)) { // ensure start or stop operations are not in progress
|
||||
if (I2C_CR1(I2C(I2C_MASTER_I2C)) & (I2C_CR1_START)) { // ensure start is not in progress
|
||||
return I2C_MASTER_RC_START_STOP_IN_PROGESS;
|
||||
}
|
||||
|
||||
@ -218,7 +218,9 @@ enum i2c_master_rc i2c_master_stop(void)
|
||||
i2c_disable_ack(I2C(I2C_MASTER_I2C)); // disable ACK to be able to close the communication
|
||||
}
|
||||
|
||||
i2c_send_stop(I2C(I2C_MASTER_I2C)); // send stop to release bus
|
||||
if (!(I2C_CR1(I2C(I2C_MASTER_I2C)) & (I2C_CR1_STOP))) { // ensure stop operations is not in progress
|
||||
i2c_send_stop(I2C(I2C_MASTER_I2C)); // send stop to release bus
|
||||
}
|
||||
return i2c_master_wait_stop();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user