mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
MPU6000: minor fixes
the hardware functions should be private, and cs_pin should be uint8_t
This commit is contained in:
parent
d35113f8a6
commit
f2bbfb1296
@ -64,7 +64,7 @@
|
|||||||
#define BIT_I2C_IF_DIS 0x10
|
#define BIT_I2C_IF_DIS 0x10
|
||||||
#define BIT_INT_STATUS_DATA 0x01
|
#define BIT_INT_STATUS_DATA 0x01
|
||||||
|
|
||||||
int AP_InertialSensor_MPU6000::_cs_pin;
|
uint8_t AP_InertialSensor_MPU6000::_cs_pin;
|
||||||
|
|
||||||
/* pch: by the data sheet, the gyro scale should be 16.4LSB per DPS
|
/* pch: by the data sheet, the gyro scale should be 16.4LSB per DPS
|
||||||
* Given the radians conversion factor (0.174532), the gyro scale factor
|
* Given the radians conversion factor (0.174532), the gyro scale factor
|
||||||
@ -90,7 +90,7 @@ const uint8_t AP_InertialSensor_MPU6000::_temp_data_index = 3;
|
|||||||
|
|
||||||
static volatile uint8_t _new_data;
|
static volatile uint8_t _new_data;
|
||||||
|
|
||||||
AP_InertialSensor_MPU6000::AP_InertialSensor_MPU6000( int cs_pin )
|
AP_InertialSensor_MPU6000::AP_InertialSensor_MPU6000( uint8_t cs_pin )
|
||||||
{
|
{
|
||||||
_cs_pin = cs_pin; /* can't use initializer list, is static */
|
_cs_pin = cs_pin; /* can't use initializer list, is static */
|
||||||
_gyro.x = 0;
|
_gyro.x = 0;
|
||||||
|
@ -14,7 +14,7 @@ class AP_InertialSensor_MPU6000 : public AP_InertialSensor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AP_InertialSensor_MPU6000( int cs_pin );
|
AP_InertialSensor_MPU6000( uint8_t cs_pin );
|
||||||
|
|
||||||
void init( AP_PeriodicProcess * scheduler );
|
void init( AP_PeriodicProcess * scheduler );
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ class AP_InertialSensor_MPU6000 : public AP_InertialSensor
|
|||||||
uint32_t sample_time();
|
uint32_t sample_time();
|
||||||
void reset_sample_time();
|
void reset_sample_time();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
static void read(uint32_t);
|
static void read(uint32_t);
|
||||||
static void data_interrupt(void);
|
static void data_interrupt(void);
|
||||||
static uint8_t register_read( uint8_t reg );
|
static uint8_t register_read( uint8_t reg );
|
||||||
static void register_write( uint8_t reg, uint8_t val );
|
static void register_write( uint8_t reg, uint8_t val );
|
||||||
static void hardware_init();
|
static void hardware_init();
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Vector3f _gyro;
|
Vector3f _gyro;
|
||||||
Vector3f _accel;
|
Vector3f _accel;
|
||||||
float _temp;
|
float _temp;
|
||||||
@ -63,7 +63,7 @@ class AP_InertialSensor_MPU6000 : public AP_InertialSensor
|
|||||||
static int16_t _data[7];
|
static int16_t _data[7];
|
||||||
|
|
||||||
/* TODO deprecate _cs_pin */
|
/* TODO deprecate _cs_pin */
|
||||||
static int _cs_pin;
|
static uint8_t _cs_pin;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __AP_INERTIAL_SENSOR_MPU6000_H__
|
#endif // __AP_INERTIAL_SENSOR_MPU6000_H__
|
||||||
|
Loading…
Reference in New Issue
Block a user