Merge pull request #1473 from jamofer/master

Issue #666  LPC1768 i2c_slave_read fix
pull/1477/head
Martin Kojtal 2015-12-14 08:38:30 +00:00
commit eed91bce3b
1 changed files with 9 additions and 2 deletions

View File

@ -351,6 +351,13 @@ int i2c_slave_read(i2c_t *obj, char *data, int length) {
} while (((status == 0x80) || (status == 0x90) ||
(status == 0x060) || (status == 0x70)) && (count < length));
// Clear old status and wait for Serial Interrupt.
i2c_clear_SI(obj);
i2c_wait_SI(obj);
// Obtain new status.
status = i2c_status(obj);
if(status != 0xA0) {
i2c_stop(obj);
}