mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Adjust interface for i2c to add requirement for device to be specified.
This commit is contained in:
parent
7a5b7060aa
commit
37e7b5ee4a
17 changed files with 104 additions and 133 deletions
|
@ -56,6 +56,10 @@ static volatile bool mpuDataReady;
|
|||
static bool detectSPISensorsAndUpdateDetectionResult(void);
|
||||
#endif
|
||||
|
||||
#ifndef MPU_I2C_INSTANCE
|
||||
#define MPU_I2C_INSTANCE I2C_DEVICE
|
||||
#endif
|
||||
|
||||
mpuDetectionResult_t mpuDetectionResult;
|
||||
|
||||
mpuConfiguration_t mpuConfiguration;
|
||||
|
@ -239,13 +243,13 @@ void mpuIntExtiInit(void)
|
|||
|
||||
static bool mpuReadRegisterI2C(uint8_t reg, uint8_t length, uint8_t* data)
|
||||
{
|
||||
bool ack = i2cRead(MPU_ADDRESS, reg, length, data);
|
||||
bool ack = i2cRead(MPU_I2C_INSTANCE, MPU_ADDRESS, reg, length, data);
|
||||
return ack;
|
||||
}
|
||||
|
||||
static bool mpuWriteRegisterI2C(uint8_t reg, uint8_t data)
|
||||
{
|
||||
bool ack = i2cWrite(MPU_ADDRESS, reg, data);
|
||||
bool ack = i2cWrite(MPU_I2C_INSTANCE, MPU_ADDRESS, reg, data);
|
||||
return ack;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue