2011-12-21 00:30:22 -04:00
|
|
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
2011-11-12 23:20:25 -04:00
|
|
|
|
|
|
|
#ifndef __AP_INERTIAL_SENSOR_OILPAN_H__
|
|
|
|
#define __AP_INERTIAL_SENSOR_OILPAN_H__
|
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include <AP_HAL/AP_HAL.h>
|
2011-11-12 23:20:25 -04:00
|
|
|
#include "AP_InertialSensor.h"
|
|
|
|
|
2014-10-15 20:31:21 -03:00
|
|
|
class AP_InertialSensor_Oilpan : public AP_InertialSensor_Backend
|
2011-11-12 23:20:25 -04:00
|
|
|
{
|
2012-08-17 03:19:56 -03:00
|
|
|
public:
|
2014-10-15 20:31:21 -03:00
|
|
|
AP_InertialSensor_Oilpan(AP_InertialSensor &imu);
|
2011-11-12 23:20:25 -04:00
|
|
|
|
2014-10-15 20:31:21 -03:00
|
|
|
/* update accel and gyro state */
|
|
|
|
bool update();
|
2013-10-08 03:28:39 -03:00
|
|
|
|
2014-10-15 20:31:21 -03:00
|
|
|
bool gyro_sample_available(void) { return _sample_available(); }
|
|
|
|
bool accel_sample_available(void) { return _sample_available(); }
|
2012-11-07 02:20:22 -04:00
|
|
|
|
2014-10-15 20:31:21 -03:00
|
|
|
// detect the sensor
|
2014-10-16 17:52:21 -03:00
|
|
|
static AP_InertialSensor_Backend *detect(AP_InertialSensor &imu);
|
|
|
|
|
2012-08-17 03:19:56 -03:00
|
|
|
private:
|
2014-10-16 17:52:21 -03:00
|
|
|
bool _init_sensor(void);
|
2014-10-15 20:31:21 -03:00
|
|
|
bool _sample_available() const;
|
2012-08-17 03:19:56 -03:00
|
|
|
static const uint8_t _sensors[6];
|
|
|
|
static const int8_t _sensor_signs[6];
|
|
|
|
static const float _gyro_gain_x;
|
|
|
|
static const float _gyro_gain_y;
|
|
|
|
static const float _gyro_gain_z;
|
|
|
|
static const float _adc_constraint;
|
2012-11-29 07:56:13 -04:00
|
|
|
uint8_t _sample_threshold;
|
2014-10-15 20:31:21 -03:00
|
|
|
uint8_t _gyro_instance;
|
|
|
|
uint8_t _accel_instance;
|
2011-11-12 23:20:25 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AP_INERTIAL_SENSOR_OILPAN_H__
|