Added external magnetometer functionality
Dependencies: HMC58X31 MODI2C MPU6050 MS561101BA
Fork of FreeIMU by
Diff: FreeIMU.h
- Revision:
- 3:f9b100a9aa65
- Parent:
- 2:5c419926dcd7
- Child:
- 6:6b1185b32814
diff -r 5c419926dcd7 -r f9b100a9aa65 FreeIMU.h --- a/FreeIMU.h Tue Nov 05 13:38:07 2013 +0000 +++ b/FreeIMU.h Sat Nov 09 08:53:25 2013 +0000 @@ -24,6 +24,9 @@ #ifndef FreeIMU_h #define FreeIMU_h +#define I2C_SDA p28 +#define I2C_SCL p27 + // Uncomment the appropriated version of FreeIMU you are using //#define FREEIMU_v01 //#define FREEIMU_v02 @@ -103,8 +106,8 @@ // HMC5843 address is fixed so don't bother to define it -#define twoKpDef (2.0f * 0.5f) // 2 * proportional gain -#define twoKiDef (2.0f * 0.1f) // 2 * integral gain +#define twoKpDef (2.0f * 7.5f) // 2 * proportional gain +#define twoKiDef (2.0f * 0.25f) // 2 * integral gain #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) @@ -140,9 +143,9 @@ // we make them public so that users can interact directly with device classes - MPU6050 accgyro; - MS561101BA baro; - HMC58X3 magn; + MPU6050 *accgyro; + MS561101BA *baro; + HMC58X3 *magn; int* raw_acc, raw_gyro, raw_magn; // calibration parameters @@ -152,7 +155,7 @@ private: - void AHRSupdate(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz); + void AHRSupdate(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz, bool _magn_valid); //float q0, q1, q2, q3; // quaternion elements representing the estimated orientation float iq0, iq1, iq2, iq3;