diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2014-11-19 22:38:37 -0500 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2015-05-27 20:50:14 -0700 |
commit | c21a588f565680d9bc1b22dff1177ca65c1b08e9 (patch) | |
tree | 87b53e9e9ced10284707fb6625b89d59b662fa01 /libraries | |
parent | 97aa002c9d268c30a13b308e7138ad2c41fde7c6 (diff) | |
download | librambutan-c21a588f565680d9bc1b22dff1177ca65c1b08e9.tar.gz librambutan-c21a588f565680d9bc1b22dff1177ca65c1b08e9.zip |
Wire: release the bus on error
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/Wire/Wire.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index d646132..b08023d 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -128,6 +128,7 @@ uint8 TwoWire::process() { // shift out the address we're transmitting to i2c_shift_out(sla_addr); if (!i2c_get_ack()) { + i2c_stop(); // Fix up the state of the bus return ENACKADDR; } // Recieving @@ -146,6 +147,7 @@ uint8 TwoWire::process() { for (uint8 i = 0; i < itc_msg.length; i++) { i2c_shift_out(itc_msg.data[i]); if (!i2c_get_ack()) { + i2c_stop(); // Fix up the state of the bus return ENACKTRNS; } itc_msg.xferred++; |