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:
parent
5f2adf6e6f
commit
7073b0e351
18 changed files with 105 additions and 98 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue