mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
clock stretch fix done right (#5363)
This commit is contained in:
parent
74ca42f829
commit
aa22c07312
@ -267,6 +267,7 @@ unsigned char twi_writeTo(unsigned char address, unsigned char * buf, unsigned i
|
|||||||
SCL_LOW();
|
SCL_LOW();
|
||||||
twi_delay(twi_dcount);
|
twi_delay(twi_dcount);
|
||||||
SCL_HIGH();
|
SCL_HIGH();
|
||||||
|
unsigned int t=0; while(SCL_READ()==0 && (t++)<twi_clockStretchLimit); // twi_clockStretchLimit
|
||||||
twi_delay(twi_dcount);
|
twi_delay(twi_dcount);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -287,6 +288,7 @@ unsigned char twi_readFrom(unsigned char address, unsigned char* buf, unsigned i
|
|||||||
SCL_LOW();
|
SCL_LOW();
|
||||||
twi_delay(twi_dcount);
|
twi_delay(twi_dcount);
|
||||||
SCL_HIGH();
|
SCL_HIGH();
|
||||||
|
unsigned int t=0; while(SCL_READ()==0 && (t++)<twi_clockStretchLimit); // twi_clockStretchLimit
|
||||||
twi_delay(twi_dcount);
|
twi_delay(twi_dcount);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user