Commit e81a5353 authored by Radomir Dopieralski's avatar Radomir Dopieralski Committed by Damien George
Browse files

extmod/machine_i2c: Release SDA on bus error

parent 9a82b67f
......@@ -117,6 +117,7 @@ STATIC int mp_hal_i2c_write_byte(machine_i2c_obj_t *self, uint8_t val) {
}
mp_hal_i2c_delay(self);
if (!mp_hal_i2c_scl_release(self)) {
mp_hal_i2c_sda_release(self);
return 0; // failure
}
mp_hal_i2c_scl_low(self);
......@@ -157,6 +158,7 @@ STATIC int mp_hal_i2c_read_byte(machine_i2c_obj_t *self, uint8_t *val, int nack)
}
mp_hal_i2c_delay(self);
if (!mp_hal_i2c_scl_release(self)) {
mp_hal_i2c_sda_release(self);
return 0; // failure
}
mp_hal_i2c_scl_low(self);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment