|
|
|
@ -58,6 +58,9 @@
@@ -58,6 +58,9 @@
|
|
|
|
|
#define REGG_FIFO_CONFIG_1 0x3E |
|
|
|
|
#define REGG_FIFO_DATA 0x3F |
|
|
|
|
|
|
|
|
|
#define ACCEL_BACKEND_SAMPLE_RATE 2000 |
|
|
|
|
#define GYRO_BACKEND_SAMPLE_RATE 2000 |
|
|
|
|
|
|
|
|
|
extern const AP_HAL::HAL& hal; |
|
|
|
|
|
|
|
|
|
#define int16_val(v, idx) ((int16_t)(((uint16_t)v[2*idx] << 8) | v[2*idx+1])) |
|
|
|
@ -98,17 +101,17 @@ AP_InertialSensor_BMI055::probe(AP_InertialSensor &imu,
@@ -98,17 +101,17 @@ AP_InertialSensor_BMI055::probe(AP_InertialSensor &imu,
|
|
|
|
|
|
|
|
|
|
void AP_InertialSensor_BMI055::start() |
|
|
|
|
{ |
|
|
|
|
accel_instance = _imu.register_accel(2000, dev_accel->get_bus_id_devtype(DEVTYPE_INS_BMI055)); |
|
|
|
|
gyro_instance = _imu.register_gyro(2000, dev_gyro->get_bus_id_devtype(DEVTYPE_INS_BMI055)); |
|
|
|
|
accel_instance = _imu.register_accel(ACCEL_BACKEND_SAMPLE_RATE, dev_accel->get_bus_id_devtype(DEVTYPE_INS_BMI055)); |
|
|
|
|
gyro_instance = _imu.register_gyro(GYRO_BACKEND_SAMPLE_RATE, dev_gyro->get_bus_id_devtype(DEVTYPE_INS_BMI055)); |
|
|
|
|
|
|
|
|
|
// setup sensor rotations from probe()
|
|
|
|
|
set_gyro_orientation(gyro_instance, rotation); |
|
|
|
|
set_accel_orientation(accel_instance, rotation); |
|
|
|
|
|
|
|
|
|
// setup callbacks
|
|
|
|
|
dev_accel->register_periodic_callback(1000, |
|
|
|
|
dev_accel->register_periodic_callback(1000000UL / ACCEL_BACKEND_SAMPLE_RATE, |
|
|
|
|
FUNCTOR_BIND_MEMBER(&AP_InertialSensor_BMI055::read_fifo_accel, void)); |
|
|
|
|
dev_gyro->register_periodic_callback(1000, |
|
|
|
|
dev_gyro->register_periodic_callback(1000000UL / GYRO_BACKEND_SAMPLE_RATE, |
|
|
|
|
FUNCTOR_BIND_MEMBER(&AP_InertialSensor_BMI055::read_fifo_gyro, void)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -156,7 +159,6 @@ bool AP_InertialSensor_BMI055::accel_init()
@@ -156,7 +159,6 @@ bool AP_InertialSensor_BMI055::accel_init()
|
|
|
|
|
goto failed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hal.console->printf("BMI055: found accel\n"); |
|
|
|
|
|
|
|
|
|
dev_accel->get_semaphore()->give(); |
|
|
|
|