aaa
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of AutoFlight2017_now2 by
Diff: MPU9250/MPU9250.h
- Revision:
- 1:f31e17341659
- Parent:
- 0:92024886c0be
diff -r 92024886c0be -r f31e17341659 MPU9250/MPU9250.h --- a/MPU9250/MPU9250.h Tue Aug 01 12:27:13 2017 +0000 +++ b/MPU9250/MPU9250.h Tue Aug 28 07:12:16 2018 +0000 @@ -27,6 +27,8 @@ #define DECLINATION -7.45f //Declination at Tokyo is -7.45 degree 2017/06/14 const float PI = 3.14159265358979323846f; +const float LPGAIN_MAG = 0.0; + enum Ascale { AFS_2G = 0, @@ -53,13 +55,13 @@ public: //MPU9250(); - MPU9250(PinName sda, PinName scl, Serial* serial_p); + MPU9250(PinName sda, PinName scl, RawSerial* serial_p); ~MPU9250(); bool Initialize(void); bool sensingAcGyMg(void); void calculatePostureAngle(float degree[3]); - + float calculateYawByMg(void); void MPU9250SelfTest(float * destination); @@ -82,7 +84,7 @@ I2C *i2c_p; I2C &i2c; - Serial* pc_p; + RawSerial* pc_p; Timer timer; @@ -114,6 +116,7 @@ float q[4]; // vector to hold quaternion float eInt[3]; // vector to hold integral error for Mahony method + float lpmag[3]; void writeByte(uint8_t address, uint8_t subAddress, uint8_t data); char readByte(uint8_t address, uint8_t subAddress); @@ -148,6 +151,7 @@ void translateQuaternionToDeg(float quaternion[4]); void calibrateDegree(void); + void transformCoordinateFromCompassToMPU(); protected: };