1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Baro and Mag driver check for I2C bus being busy (#13509)

* Baro and Mag driver check for I2C bus being busy

* Update src/main/drivers/bus_i2c_busdev.c

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>

---------

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
This commit is contained in:
Steve Evans 2024-04-10 00:53:33 +01:00 committed by GitHub
parent 5f2adf6e6f
commit 7073b0e351
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 105 additions and 98 deletions

View file

@ -41,6 +41,10 @@ bool i2cBusWriteRegisterStart(const extDevice_t *dev, uint8_t reg, uint8_t data)
// Need a static value, not on the stack
static uint8_t byte;
if (i2cBusy(dev->bus->busType_u.i2c.device, NULL)) {
return false;
}
byte = data;
return i2cWriteBuffer(dev->bus->busType_u.i2c.device, dev->busType_u.i2c.address, reg, sizeof(byte), &byte);