forked from esp8266/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repair I2C communication issue 698 esp8266#698
- Loading branch information
Showing
1 changed file
with
1 addition
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,7 +150,7 @@ static unsigned char twi_read_byte(bool nack) { | |
unsigned char twi_writeTo(unsigned char address, unsigned char * buf, unsigned int len, unsigned char sendStop){ | ||
unsigned int i; | ||
if(!twi_write_start()) return 4;//line busy | ||
if(!twi_write_byte(((address << 1) | 0) & 0xFF)) return 2;//received NACK on transmit of address | ||
if(!twi_write_byte(((address << 1) | 0) & 0xFF)) {twi_write_stop();return 2;}//received NACK on transmit of address | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
petrd
Author
Owner
|
||
for(i=0; i<len; i++){ | ||
if(!twi_write_byte(buf[i])) return 3;//received NACK on transmit of data | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
petrd
Author
Owner
|
||
} | ||
|
My guess is that this should be
if (sendStop) twi_write_stop();
, but please verify if that works with your sensor.