8000 Double I2C read in one transaction skips a clock pulse (#5528) by TD-er · Pull Request #6654 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Double I2C read in one transaction skips a clock pulse (#5528) #6654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 27, 2019
Prev Previous commit
Next Next commit
[I2C] Move duplicated clock stretch call to twi_scl_valley function
  • Loading branch information
TD-er committed Oct 26, 2019
commit 702361ce72692b6f401a66306d22de7bcebb48f1
5 changes: 1 addition & 4 deletions cores/esp8266/core_esp8266_si2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,15 +391,13 @@ unsigned char Twi::writeTo(unsigned char address, unsigned char * buf, unsigned
else
{
twi_scl_valley();
WAIT_CLOCK_STRETCH();
// TD-er: Also busywait(twi_dcount) here?
// busywait(twi_dcount);
}
i = 0;
while (!SDA_READ() && (i++) < 10)
{
twi_scl_valley();
WAIT_CLOCK_STRETCH();
busywait(twi_dcount);
}
return 0;
Expand Down Expand Up @@ -432,15 +430,13 @@ unsigned char Twi::readFrom(unsigned char address, unsigned char* buf, unsigned
else
{
twi_scl_valley();
WAIT_CLOCK_STRETCH();
// TD-er: Also busywait(twi_dcount) here?
// busywait(twi_dcount);
}
i = 0;
while (!SDA_READ() && (i++) < 10)
{
twi_scl_valley();
WAIT_CLOCK_STRETCH();
busywait(twi_dcount);
}
return 0;
Expand Down Expand Up @@ -666,6 +662,7 @@ void Twi::twi_scl_valley(void)
SCL_LOW();
busywait(twi_dcount);
SCL_HIGH();
WAIT_CLOCK_STRETCH();
}

void ICACHE_RAM_ATTR Twi::onTimer(void *unused)
Expand Down
0