diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2016-11-13 21:18:07 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-11-17 12:43:13 +1100 |
commit | e81a5353cb794b8d6c57317488e5db6a1c524755 (patch) | |
tree | c053a8a2743506d600e9abe3502928055bd1224c /extmod/machine_i2c.c | |
parent | 9a82b67f39040dd1cd53fdddf18a5fa432e3fdac (diff) | |
download | micropython-e81a5353cb794b8d6c57317488e5db6a1c524755.tar.gz micropython-e81a5353cb794b8d6c57317488e5db6a1c524755.zip |
extmod/machine_i2c: Release SDA on bus error
Diffstat (limited to 'extmod/machine_i2c.c')
-rw-r--r-- | extmod/machine_i2c.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/extmod/machine_i2c.c b/extmod/machine_i2c.c index eacac15e63..dc16d78c54 100644 --- a/extmod/machine_i2c.c +++ b/extmod/machine_i2c.c @@ -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); |