mpu9150: option to disable I2C bypass setting

The existing hardcoded logic enables i2c bypass mode for AK8975.
This can cause the accelerometer to disappear on I2C bus. We add
a new member as a switch that can be used to disable bypass.

Change-Id: I2c61f4910d46ffb5940bb3c14b58bc65984fd12e
Signed-off-by: Jianxun Zhang <jianxun.zhang@intel.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Jianxun Zhang
2015-10-19 00:41:34 -07:00
committed by Mihai Tudor Panu
parent fd509c7d79
commit ac21c9336b
2 changed files with 27 additions and 19 deletions

View File

@@ -66,9 +66,11 @@ namespace upm {
* @param bus I2C bus to use
* @param address The address for this device
* @param magAddress The address of the connected magnetometer
* @param enableAk8975 Enables i2c bypass mode for magnetometer, default
* is true
*/
MPU9150 (int bus=MPU9150_I2C_BUS, int address=MPU9150_DEFAULT_I2C_ADDR,
int magAddress=AK8975_DEFAULT_I2C_ADDR);
int magAddress=AK8975_DEFAULT_I2C_ADDR, bool enableAk8975=true);
/**
* MPU9150 destructor
@@ -126,6 +128,7 @@ namespace upm {
private:
int m_i2cBus;
uint8_t m_magAddress;
bool m_enableAk8975;
};
}