drivers: minimize additional I2C retries

This commit is contained in:
Daniel Agar
2021-08-17 09:54:50 -04:00
parent 8a8171c7aa
commit cb610caf1e
18 changed files with 44 additions and 109 deletions
+1 -13
View File
@@ -134,25 +134,13 @@ RGBLED::probe()
bool on, powersave;
uint8_t r, g, b;
/**
this may look strange, but is needed. There is a serial
EEPROM (Microchip-24aa01) that responds to a bunch of I2C
addresses, including the 0x55 used by this LED device. So
we need to do enough operations to be sure we are talking
to the right device. These 3 operations seem to be enough,
as the 3rd one consistently fails if no RGBLED is on the bus.
*/
unsigned prevretries = _retries;
_retries = 4;
if ((ret = get(on, powersave, r, g, b)) != OK ||
(ret = send_led_enable(false) != OK) ||
(ret = send_led_enable(false) != OK)) {
return ret;
}
_retries = prevretries;
_retries = 1;
return ret;
}