提交 7eff707b 编写于 作者: C chuck todd 提交者: Me No Dev

Fix Early return when Address NAK is received (#750)

The i2cWrite() function was returning to the app before the i2c transaction had completed.  This caused the next Wire() call to return a I2C_ERROR_BUSY.
上级 81f225a4
......@@ -229,7 +229,7 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat
//Transmission did not finish and ACK_ERR is set
if(i2c->dev->int_raw.ack_err) {
log_w("Ack Error! Addr: %x", address >> 1);
while((i2c->dev->status_reg.bus_busy) && ((millis() - startAt)>50));
while((i2c->dev->status_reg.bus_busy) && ((millis() - startAt)<50));
I2C_MUTEX_UNLOCK();
return I2C_ERROR_ACK;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册