diff --git a/cores/esp8266/core_esp8266_si2c.c b/cores/esp8266/core_esp8266_si2c.c index 29149aa09..cff2809d3 100644 --- a/cores/esp8266/core_esp8266_si2c.c +++ b/cores/esp8266/core_esp8266_si2c.c @@ -150,6 +150,13 @@ unsigned char twi_writeTo(unsigned char address, unsigned char * buf, unsigned i if(!twi_write_byte(buf[i])) return 3;//received NACK on transmit of data } if(sendStop) twi_write_stop(); + i = 0; + while(SDA_READ() == 0 && (i++) < 10){ + SCL_LOW(); + twi_delay(twi_dcount); + SCL_HIGH(); + twi_delay(twi_dcount); + } return 0; } @@ -158,15 +165,13 @@ unsigned char twi_readFrom(unsigned char address, unsigned char* buf, unsigned i if(!twi_write_start()) return 4;//line busy if(!twi_write_byte(((address << 1) | 1) & 0xFF)) return 2;//received NACK on transmit of address for(i=0; i