mirror of https://github.com/ARMmbed/mbed-os.git
fix multibyte reads (was polling wrong status value)
parent
ab2b426832
commit
94ac072267
|
@ -138,7 +138,7 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
|
||||||
LPC_I2C0->MSTCTL = (1 << 0);
|
LPC_I2C0->MSTCTL = (1 << 0);
|
||||||
data[count] = (LPC_I2C0->MSTDAT & 0xFF);
|
data[count] = (LPC_I2C0->MSTDAT & 0xFF);
|
||||||
status = ((LPC_I2C0->STAT >> 1) & (0x07));
|
status = ((LPC_I2C0->STAT >> 1) & (0x07));
|
||||||
if (status != 0x00) {
|
if (status != 0x01) {
|
||||||
i2c_stop(obj);
|
i2c_stop(obj);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue