Skip to content

Commit aa22c07

Browse files
suculentdevyte
authored andcommitted
clock stretch fix done right (esp8266#5363)
1 parent 74ca42f commit aa22c07

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cores/esp8266/core_esp8266_si2c.c

+2
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ unsigned char twi_writeTo(unsigned char address, unsigned char * buf, unsigned i
267267
SCL_LOW();
268268
twi_delay(twi_dcount);
269269
SCL_HIGH();
270+
unsigned int t=0; while(SCL_READ()==0 && (t++)<twi_clockStretchLimit); // twi_clockStretchLimit
270271
twi_delay(twi_dcount);
271272
}
272273
return 0;
@@ -287,6 +288,7 @@ unsigned char twi_readFrom(unsigned char address, unsigned char* buf, unsigned i
287288
SCL_LOW();
288289
twi_delay(twi_dcount);
289290
SCL_HIGH();
291+
unsigned int t=0; while(SCL_READ()==0 && (t++)<twi_clockStretchLimit); // twi_clockStretchLimit
290292
twi_delay(twi_dcount);
291293
}
292294
return 0;

0 commit comments

Comments
 (0)