Fixing the return for i2c_byte_write.

pull/1560/head
Kevin Gillespie 2016-02-22 15:45:54 -06:00
parent 936c576140
commit 9bc9668287
2 changed files with 22 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}