AP_InertialSensor: added start() method for LSM9DS0

needed to get sensor ordering right on multi-sensor boards
This commit is contained in:
Andrew Tridgell 2016-11-03 20:17:49 +11:00
parent b9e1490740
commit ac2572384d
2 changed files with 18 additions and 9 deletions

View File

@ -490,14 +490,6 @@ bool AP_InertialSensor_LSM9DS0::_hardware_init()
_spi_sem->give();
_gyro_instance = _imu.register_gyro(760);
_accel_instance = _imu.register_accel(800);
_set_accel_max_abs_offset(_accel_instance, 5.0f);
/* start the timer process to read samples */
_dev_gyro->register_periodic_callback(1000, FUNCTOR_BIND_MEMBER(&AP_InertialSensor_LSM9DS0::_poll_data, bool));
return true;
fail_tries:
@ -506,6 +498,22 @@ fail_whoami:
return false;
}
/*
start the sensor going
*/
void AP_InertialSensor_LSM9DS0::start(void)
{
_gyro_instance = _imu.register_gyro(760);
_accel_instance = _imu.register_accel(800);
_set_accel_max_abs_offset(_accel_instance, 5.0f);
/* start the timer process to read samples */
_dev_gyro->register_periodic_callback(1000, FUNCTOR_BIND_MEMBER(&AP_InertialSensor_LSM9DS0::_poll_data, bool));
}
uint8_t AP_InertialSensor_LSM9DS0::_register_read_xm(uint8_t reg)
{
uint8_t val = 0;

View File

@ -12,7 +12,8 @@ class AP_InertialSensor_LSM9DS0 : public AP_InertialSensor_Backend
{
public:
virtual ~AP_InertialSensor_LSM9DS0() { }
bool update();
void start(void) override;
bool update() override;
static AP_InertialSensor_Backend *probe(AP_InertialSensor &imu,
AP_HAL::OwnPtr<AP_HAL::SPIDevice> dev_gyro,