SoftI2C fork with ack fix

Files at this revision

API Documentation at this revision

Comitter:
wkleunen
Date:
Wed May 22 12:26:36 2019 +0000
Parent:
1:05473196d133
Commit message:
The ACK of an i2c transfer was incorrectly read, device acknowledges if SDA is pulled low after transfer

Changed in this revision

SoftI2C.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 05473196d133 -r 9ee34b54555e SoftI2C.cpp
--- a/SoftI2C.cpp	Mon Nov 28 19:55:30 2016 +0000
+++ b/SoftI2C.cpp	Wed May 22 12:26:36 2019 +0000
@@ -126,7 +126,7 @@
     
     _scl.write(1);
     wait_us(delay_us);
-    int retval = ~_sda.read(); //Read the ack
+    int retval = !_sda.read(); //Read the ack
     wait_us(delay_us);
     
     return retval;