mirror of https://github.com/ARMmbed/mbed-os.git
[MAX326xx] Fixed i2c_byte_write() return value.
parent
0e330ef1fa
commit
301d7f271f
|
@ -228,11 +228,11 @@ 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)) {}
|
||||
while (!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY));
|
||||
|
||||
if (obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
|
||||
i2c_reset(obj);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
|
||||
|
@ -240,7 +240,7 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i2c_byte_read(i2c_t *obj, int last)
|
||||
|
|
|
@ -228,11 +228,11 @@ 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)) {}
|
||||
while (!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY));
|
||||
|
||||
if (obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
|
||||
i2c_reset(obj);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
|
||||
|
@ -240,7 +240,7 @@ int i2c_byte_write(i2c_t *obj, int data)
|
|||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i2c_byte_read(i2c_t *obj, int last)
|
||||
|
|
Loading…
Reference in New Issue