Skip to content

Commit

Permalink
- move ACC_1G def and GYRO_SCALE in Sensors.h
Browse files Browse the repository at this point in the history
git-svn-id: http://multiwii.googlecode.com/svn/trunk/MultiWii_shared@1609 02679b44-d973-9852-f2fa-63770883b36c
  • Loading branch information
[email protected] committed Nov 11, 2013
1 parent a4f6ece commit d13f84f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 68 deletions.
2 changes: 2 additions & 0 deletions Sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "EEPROM.h"
#include "IMU.h"
#include "LCD.h"
#include "Sensors.h"


void i2c_BMP085_UT_Start(void);

Expand Down
68 changes: 68 additions & 0 deletions Sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,73 @@ uint8_t i2c_readReg(uint8_t add, uint8_t reg);
uint8_t i2c_readAck();
uint8_t i2c_readNak();

#if defined(MMA7455)
#define ACC_1G 64
#endif
#if defined(MMA8451Q)
#define ACC_1G 512
#endif
#if defined(ADXL345)
#define ACC_1G 265
#endif
#if defined(BMA180)
#define ACC_1G 255
#endif
#if defined(BMA280)
#define ACC_1G 255
#endif
#if defined(BMA020)
#define ACC_1G 63
#endif
#if defined(NUNCHACK)
#define ACC_1G 200
#endif
#if defined(LIS3LV02)
#define ACC_1G 256
#endif
#if defined(LSM303DLx_ACC)
#define ACC_1G 256
#endif
#if defined(ADCACC)
#define ACC_1G 75
#endif
#if defined(MPU6050)
#if defined(FREEIMUv04)
#define ACC_1G 255
#else
#define ACC_1G 512
#endif
#endif
#if defined(LSM330)
#define ACC_1G 256
#endif
#if defined(NUNCHUCK)
#define ACC_1G 200
#endif
#if !defined(ACC_1G)
#define ACC_1G 256
#endif
#define ACCZ_25deg (int16_t)(ACC_1G * 0.90631) // 0.90631 = cos(25deg) (cos(theta) of accZ comparison)
#define ACC_VelScale (9.80665f / 10000.0f / ACC_1G)

// GYRO SCALE: we ignore the last 2 bits and convert it for rad/s
#if defined(ITG3200)
#define GYRO_SCALE (4 / 14.375 * PI / 180.0 / 1000000.0) //ITG3200 14.375 LSB = 1 deg/s
#endif
#if defined(L3G4200D)
#define GYRO_SCALE ((4.0f * PI * 70.0f)/(1000.0f * 180.0f * 1000000.0f)) // 70 milli deg/s /digit => 1 deg/s = 1000/70 LSB
#endif
#if defined(MPU6050)
#define GYRO_SCALE (4 / 16.4 * PI / 180.0 / 1000000.0) //MPU6050 and MPU3050 16.4 LSB = 1 deg/s
#endif
#if defined(LSM330)
#define GYRO_SCALE ((4.0f * PI * 70.0f)/(1000.0f * 180.0f * 1000000.0f)) // like L3G4200D
#endif
#if defined(MPU3050)
#define GYRO_SCALE (4 / 16.4 * PI / 180.0 / 1000000.0) //MPU6050 and MPU3050 16.4 LSB = 1 deg/s
#endif
#if defined(WMP)
#define GYRO_SCALE (1.0f/200e6f)
#endif

#endif /* SENSORS_H_ */
68 changes: 0 additions & 68 deletions def.h
Original file line number Diff line number Diff line change
Expand Up @@ -1633,74 +1633,6 @@
#endif


#if defined(MMA7455)
#define ACC_1G 64
#endif
#if defined(MMA8451Q)
#define ACC_1G 512
#endif
#if defined(ADXL345)
#define ACC_1G 265
#endif
#if defined(BMA180)
#define ACC_1G 255
#endif
#if defined(BMA280)
#define ACC_1G 255
#endif
#if defined(BMA020)
#define ACC_1G 63
#endif
#if defined(NUNCHACK)
#define ACC_1G 200
#endif
#if defined(LIS3LV02)
#define ACC_1G 256
#endif
#if defined(LSM303DLx_ACC)
#define ACC_1G 256
#endif
#if defined(ADCACC)
#define ACC_1G 75
#endif
#if defined(MPU6050)
#if defined(FREEIMUv04)
#define ACC_1G 255
#else
#define ACC_1G 512
#endif
#endif
#if defined(LSM330)
#define ACC_1G 256
#endif
#if defined(NUNCHUCK)
#define ACC_1G 200
#endif
#if !defined(ACC_1G)
#define ACC_1G 256
#endif
#define ACCZ_25deg (int16_t)(ACC_1G * 0.90631) // 0.90631 = cos(25deg) (cos(theta) of accZ comparison)
#define ACC_VelScale (9.80665f / 10000.0f / ACC_1G)

#if defined(ITG3200)
#define GYRO_SCALE (4 / 14.375 * PI / 180.0 / 1000000.0) //ITG3200 14.375 LSB/(deg/s) and we ignore the last 2 bits
#endif
#if defined(L3G4200D)
#define GYRO_SCALE ((4.0f * PI * 70.0f)/(1000.0f * 180.0f * 1000000.0f))
#endif
#if defined(MPU6050)
#define GYRO_SCALE (4 / 16.4 * PI / 180.0 / 1000000.0) //MPU6050 and MPU3050 16.4 LSB/(deg/s) and we ignore the last 2 bits
#endif
#if defined(LSM330)
#define GYRO_SCALE ((4.0f * PI * 70.0f)/(1000.0f * 180.0f * 1000000.0f)) // like L3G4200D
#endif
#if defined(MPU3050)
#define GYRO_SCALE (4 / 16.4 * PI / 180.0 / 1000000.0) //MPU6050 and MPU3050 16.4 LSB/(deg/s) and we ignore the last 2 bits
#endif
#if defined(WMP)
#define GYRO_SCALE (1.0f/200e6f)
#endif

/**************************************************************************************/
/*************** Multitype decleration for the GUI's ********************/
/**************************************************************************************/
Expand Down

0 comments on commit d13f84f

Please sign in to comment.