i2c: I2cSetDevice wrong behavior

Most drivers do not expect address blocking after calling i2cSetDevice.
I2cSetActive removed from I2cSetDevice. All drivers waiting for this call are fixed.

refs #7556
This commit is contained in:
Leonid Muravjev 2020-01-19 16:15:18 +03:00
parent 6c83787210
commit e03a14ce21
4 changed files with 4 additions and 5 deletions

View File

@ -1521,11 +1521,7 @@ bool I2cSetDevice(uint32_t addr)
return false; // If already active report as not present;
}
Wire.beginTransmission((uint8_t)addr);
bool result = (0 == Wire.endTransmission());
if (result) {
I2cSetActive(addr, 1);
}
return result;
return (0 == Wire.endTransmission());
}
#endif // USE_I2C

View File

@ -4775,6 +4775,7 @@ bool Xdrv10(uint8_t function)
glob_script_mem.script_pram_size=MAX_SCRIPT_SIZE;
glob_script_mem.flags=1;
I2cSetActiveFound(EEPROM_ADDRESS, "EEPROM");
}
}
#endif

View File

@ -116,6 +116,7 @@ void ILI9488_InitDriver()
if (I2cEnabled(XI2C_38) && I2cSetDevice(FT6236_address)) {
FT6236begin(FT6236_address);
FT6236_found=1;
I2cSetActiveFound(FT6236_address, "FT6236");
} else {
FT6236_found=0;
}

View File

@ -101,6 +101,7 @@ void RA8876_InitDriver()
if (I2cEnabled(XI2C_39) && I2cSetDevice(FT5316_address)) {
FT6236begin(FT5316_address);
FT5316_found=1;
I2cSetActiveFound(FT5316_address, "FT5316");
} else {
FT5316_found=0;
}