AP_BattMonitor: Maxell battery on any I2C bus

This commit is contained in:
murata 2018-03-16 23:00:28 +09:00 committed by Randy Mackay
parent 30a0f22d13
commit 4192ec1700
3 changed files with 10 additions and 3 deletions

View File

@ -115,12 +115,12 @@ AP_BattMonitor::init()
#if HAL_BATTMON_SMBUS_ENABLE
case AP_BattMonitor_Params::BattMonitor_TYPE_SOLO:
drivers[instance] = new AP_BattMonitor_SMBus_Solo(*this, state[instance], _params[instance],
hal.i2c_mgr->get_device(AP_BATTMONITOR_SMBUS_BUS_INTERNAL, AP_BATTMONITOR_SMBUS_I2C_ADDR,
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:
drivers[instance] = new AP_BattMonitor_SMBus_Maxell(*this, state[instance], _params[instance],
hal.i2c_mgr->get_device(AP_BATTMONITOR_SMBUS_BUS_EXTERNAL, AP_BATTMONITOR_SMBUS_I2C_ADDR,
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20));
break;
#endif // HAL_BATTMON_SMBUS_ENABLE

View File

@ -162,6 +162,13 @@ const AP_Param::GroupInfo AP_BattMonitor_Params::var_info[] = {
// @User: Advanced
AP_GROUPINFO("ARM_MAH", 19, AP_BattMonitor_Params, _arming_minimum_capacity, 0),
// @Param: BUS
// @DisplayName: Battery monitor I2C bus number
// @Description: Battery monitor I2C bus number
// @Range: 0 3
// @User: Standard
AP_GROUPINFO("BUS", 20, AP_BattMonitor_Params, _i2c_bus, 0),
AP_GROUPEND
};

View File

@ -55,5 +55,5 @@ public:
AP_Int8 _failsafe_critical_action; /// action to preform on a critical battery failsafe
AP_Int32 _arming_minimum_capacity; /// capacity level required to arm
AP_Float _arming_minimum_voltage; /// voltage level required to arm
AP_Int8 _i2c_bus; /// I2C bus number
};