2016-01-19 00:27:29 -04:00
|
|
|
#pragma once
|
2013-10-07 21:07:59 -03:00
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include <AP_HAL/AP_HAL.h>
|
2014-07-06 23:03:57 -03:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
2013-10-07 21:07:59 -03:00
|
|
|
|
2016-01-19 01:07:09 -04:00
|
|
|
#include <AP_HAL/I2CDevice.h>
|
2015-08-11 03:28:43 -03:00
|
|
|
#include <Filter/Filter.h>
|
|
|
|
#include <Filter/LowPassFilter2p.h>
|
2013-10-07 21:07:59 -03:00
|
|
|
|
2016-01-19 00:27:29 -04:00
|
|
|
#include "AP_InertialSensor.h"
|
2016-01-19 21:26:31 -04:00
|
|
|
#include "AP_InertialSensor_Backend.h"
|
2016-01-19 00:27:29 -04:00
|
|
|
|
2014-10-15 20:55:18 -03:00
|
|
|
class AP_InertialSensor_L3G4200D : public AP_InertialSensor_Backend
|
2013-10-07 21:07:59 -03:00
|
|
|
{
|
|
|
|
public:
|
2016-01-19 01:07:09 -04:00
|
|
|
AP_InertialSensor_L3G4200D(AP_InertialSensor &imu,
|
|
|
|
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev);
|
|
|
|
virtual ~AP_InertialSensor_L3G4200D();
|
|
|
|
|
|
|
|
// probe the sensor on I2C bus
|
|
|
|
static AP_InertialSensor_Backend *probe(AP_InertialSensor &imu,
|
|
|
|
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev);
|
2013-10-07 21:07:59 -03:00
|
|
|
|
2014-10-15 20:55:18 -03:00
|
|
|
/* update accel and gyro state */
|
2016-11-03 21:06:19 -03:00
|
|
|
bool update() override;
|
2014-10-15 20:55:18 -03:00
|
|
|
|
2016-11-03 21:06:19 -03:00
|
|
|
void start(void) override;
|
2014-10-15 23:14:56 -03:00
|
|
|
|
2013-10-07 21:07:59 -03:00
|
|
|
private:
|
2016-01-19 00:29:56 -04:00
|
|
|
bool _init_sensor();
|
2016-11-03 21:06:19 -03:00
|
|
|
bool _accumulate();
|
2015-03-19 18:55:25 -03:00
|
|
|
|
2016-01-19 01:07:09 -04:00
|
|
|
AP_HAL::OwnPtr<AP_HAL::I2CDevice> _dev;
|
|
|
|
|
2014-10-15 20:55:18 -03:00
|
|
|
// gyro and accel instances
|
|
|
|
uint8_t _gyro_instance;
|
|
|
|
uint8_t _accel_instance;
|
2013-10-07 21:07:59 -03:00
|
|
|
};
|
|
|
|
#endif
|