We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent afbfbca commit 0df27f6Copy full SHA for 0df27f6
libraries/Nicla_System/src/RGBled.cpp
@@ -160,7 +160,9 @@ uint8_t RGBled::readByte(uint8_t address, uint8_t subAddress)
160
Wire1.write(subAddress);
161
Wire1.endTransmission(false);
162
Wire1.requestFrom(address, 1);
163
- while(!Wire1.available()) {}
+ uint32_t timeout = 100;
164
+ uint32_t start_time = millis();
165
+ while(!Wire1.available() && (millis() - start_time) < timeout) {}
166
uint8_t ret = Wire1.read();
167
nicla::i2c_mutex.unlock();
168
return ret;
0 commit comments