mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #1560 from kgills/i2c_byte_write_fix
[MAX32600MBED MAXWSNENV] Fixing the return for i2c_byte_write.pull/1568/head
commit
fb3928665a
|
@ -227,6 +227,17 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
|
||||
obj->i2c->trans |= MXC_F_I2CM_TRANS_TX_START;
|
||||
|
||||
// Wait for the FIFO to be empty
|
||||
while(!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY)) {}
|
||||
|
||||
if(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -227,6 +227,17 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
|
||||
obj->i2c->trans |= MXC_F_I2CM_TRANS_TX_START;
|
||||
|
||||
// Wait for the FIFO to be empty
|
||||
while(!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY)) {}
|
||||
|
||||
if(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue