|
|
|
@ -63,12 +63,12 @@
@@ -63,12 +63,12 @@
|
|
|
|
|
|
|
|
|
|
extern const AP_HAL::HAL &hal; |
|
|
|
|
|
|
|
|
|
AP_Compass_Backend *AP_Compass_BMM150::probe(AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev, enum Rotation rotation) |
|
|
|
|
AP_Compass_Backend *AP_Compass_BMM150::probe(AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev, bool force_external, enum Rotation rotation) |
|
|
|
|
{ |
|
|
|
|
if (!dev) { |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
AP_Compass_BMM150 *sensor = new AP_Compass_BMM150(std::move(dev), rotation); |
|
|
|
|
AP_Compass_BMM150 *sensor = new AP_Compass_BMM150(std::move(dev), force_external, rotation); |
|
|
|
|
if (!sensor || !sensor->init()) { |
|
|
|
|
delete sensor; |
|
|
|
|
return nullptr; |
|
|
|
@ -77,8 +77,8 @@ AP_Compass_Backend *AP_Compass_BMM150::probe(AP_HAL::OwnPtr<AP_HAL::I2CDevice> d
@@ -77,8 +77,8 @@ AP_Compass_Backend *AP_Compass_BMM150::probe(AP_HAL::OwnPtr<AP_HAL::I2CDevice> d
|
|
|
|
|
return sensor; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
AP_Compass_BMM150::AP_Compass_BMM150(AP_HAL::OwnPtr<AP_HAL::Device> dev, enum Rotation rotation) |
|
|
|
|
: _dev(std::move(dev)), _rotation(rotation) |
|
|
|
|
AP_Compass_BMM150::AP_Compass_BMM150(AP_HAL::OwnPtr<AP_HAL::Device> dev, bool force_external, enum Rotation rotation) |
|
|
|
|
: _dev(std::move(dev)), _rotation(rotation), _force_external(force_external) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -219,6 +219,9 @@ bool AP_Compass_BMM150::init()
@@ -219,6 +219,9 @@ bool AP_Compass_BMM150::init()
|
|
|
|
|
|
|
|
|
|
set_rotation(_compass_instance, _rotation); |
|
|
|
|
|
|
|
|
|
if (_force_external) { |
|
|
|
|
set_external(_compass_instance, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_perf_err = hal.util->perf_alloc(AP_HAL::Util::PC_COUNT, "BMM150_err"); |
|
|
|
|
|
|
|
|
|