Skip to content

Commit

Permalink
Merge pull request #321 from Frederik-Wagner/bugfix/timeout
Browse files Browse the repository at this point in the history
Adapting timeout while-loop in Wire.cpp
  • Loading branch information
ederjc authored Dec 9, 2024
2 parents 887ee98 + b5af966 commit 0b0e5cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,12 @@ uint8_t TwoWire::requestFrom(
// wait for ACK or timeout incase no ACK is received, a time-based wait-state is added since XMC
// devices run at variable frequencies
while (((XMC_I2C_CH_GetStatusFlag(XMC_I2C_config->channel) &
XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED) == 0U) ||
timeout == 0) {
XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED) == 0U)) {
delay(1);
timeout--;
if (timeout == 0) {
break;
}
}

for (uint8_t count = 0; count < (quantity - 1); count++) {
Expand Down

0 comments on commit 0b0e5cc

Please sign in to comment.