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
+3 -11
View File
@@ -85,18 +85,15 @@ int MPL3115A2::init()
int MPL3115A2::probe()
{
_retries = 10;
uint8_t whoami = 0;
if ((RegisterRead(MPL3115A2_REG_WHO_AM_I, &whoami) > 0) && (whoami == MPL3115A2_WHO_AM_I)) {
/*
* Disable retries; we may enable them selectively in some cases,
* but the device gets confused if we retry some of the commands.
*/
_retries = 0;
return PX4_OK;
}
_retries = 1;
return -EIO;
}
@@ -198,11 +195,6 @@ int MPL3115A2::measure()
// Send the command to read the ADC for P and T.
unsigned addr = (MPL3115A2_CTRL_REG1 << 8) | MPL3115A2_CTRL_TRIGGER;
/*
* Disable retries on this command; we can't know whether failure
* means the device did or did not see the command.
*/
_retries = 0;
int ret = RegisterWrite((addr >> 8) & 0xff, addr & 0xff);
if (ret == -EIO) {