AP_BattMonitor: set default I2C bus for Solo and Maxell drivers

This commit is contained in:
Randy Mackay 2019-12-17 15:17:00 +09:00 committed by Andrew Tridgell
parent 0d034821d1
commit 0288b3d43c
1 changed files with 2 additions and 0 deletions

View File

@ -114,11 +114,13 @@ AP_BattMonitor::init()
break;
#if HAL_BATTMON_SMBUS_ENABLE
case AP_BattMonitor_Params::BattMonitor_TYPE_SOLO:
_params[instance]._i2c_bus.set_default(AP_BATTMONITOR_SMBUS_BUS_INTERNAL);
drivers[instance] = new AP_BattMonitor_SMBus_Solo(*this, state[instance], _params[instance],
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20));
break;
case AP_BattMonitor_Params::BattMonitor_TYPE_MAXELL:
_params[instance]._i2c_bus.set_default(AP_BATTMONITOR_SMBUS_BUS_EXTERNAL);
drivers[instance] = new AP_BattMonitor_SMBus_Maxell(*this, state[instance], _params[instance],
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20));