aaa

Dependencies:   ArduinoSerial I2Cdev2

Dependents:   AutoFlight2017_now2 AutoFlight2018_Control sbus_test_2018 Autoflight2018_sbusread ... more

Committer:
TUATBM
Date:
Tue Aug 28 07:09:21 2018 +0000
Revision:
0:c3af3416e383
Child:
2:ff025b9c6c7c
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TUATBM 0:c3af3416e383 1 #ifndef _MPU6050_DMP_6_H_
TUATBM 0:c3af3416e383 2 #define _MPU6050_DMP_6_H_
TUATBM 0:c3af3416e383 3
TUATBM 0:c3af3416e383 4 #include "MPU6050.h"
TUATBM 0:c3af3416e383 5 #include "mbed.h"
TUATBM 0:c3af3416e383 6 #include "I2Cdev.h"
TUATBM 0:c3af3416e383 7
TUATBM 0:c3af3416e383 8 #define MPU6050_INCLUDE_DMP_MOTIONAPPS20
TUATBM 0:c3af3416e383 9
TUATBM 0:c3af3416e383 10 class MPU6050DMP6 {
TUATBM 0:c3af3416e383 11 public:
TUATBM 0:c3af3416e383 12 MPU6050DMP6(PinName intpin, RawSerial* serial_p);
TUATBM 0:c3af3416e383 13 ~MPU6050DMP6();
TUATBM 0:c3af3416e383 14
TUATBM 0:c3af3416e383 15 int setup();
TUATBM 0:c3af3416e383 16 void loop();
TUATBM 0:c3af3416e383 17 void getRollPitchYaw_Skipper(float RPY[3]);
TUATBM 0:c3af3416e383 18
TUATBM 0:c3af3416e383 19
TUATBM 0:c3af3416e383 20 private:
TUATBM 0:c3af3416e383 21 RawSerial* pc_p;
TUATBM 0:c3af3416e383 22 InterruptIn *checkpin_p;
TUATBM 0:c3af3416e383 23 InterruptIn &checkpin;
TUATBM 0:c3af3416e383 24
TUATBM 0:c3af3416e383 25 MPU6050 mpu;
TUATBM 0:c3af3416e383 26 //MPU6050 mpu(0x69); // <-- use for AD0 high
TUATBM 0:c3af3416e383 27
TUATBM 0:c3af3416e383 28
TUATBM 0:c3af3416e383 29 // MPU control/status vars
TUATBM 0:c3af3416e383 30 bool dmpReady; // set true if DMP init was successful
TUATBM 0:c3af3416e383 31 uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU
TUATBM 0:c3af3416e383 32 uint8_t devStatus; // return status after each device operation (0 = success, !0 = error)
TUATBM 0:c3af3416e383 33 uint16_t packetSize; // expected DMP packet size (default is 42 bytes)
TUATBM 0:c3af3416e383 34 uint16_t fifoCount; // count of all bytes currently in FIFO
TUATBM 0:c3af3416e383 35 uint8_t fifoBuffer[64]; // FIFO storage buffer
TUATBM 0:c3af3416e383 36
TUATBM 0:c3af3416e383 37 // orientation/motion vars
TUATBM 0:c3af3416e383 38 Quaternion q,q2; // [w, x, y, z] quaternion container
TUATBM 0:c3af3416e383 39 VectorInt16 aa; // [x, y, z] accel sensor measurements
TUATBM 0:c3af3416e383 40 VectorInt16 aaReal; // [x, y, z] gravity-free accel sensor measurements
TUATBM 0:c3af3416e383 41 VectorInt16 aaWorld; // [x, y, z] world-frame accel sensor measurements
TUATBM 0:c3af3416e383 42 VectorFloat gravity; // [x, y, z] gravity vector
TUATBM 0:c3af3416e383 43 float euler[3]; // [psi, theta, phi] Euler angle container
TUATBM 0:c3af3416e383 44 float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector
TUATBM 0:c3af3416e383 45
TUATBM 0:c3af3416e383 46 // packet structure for InvenSense teapot demo
TUATBM 0:c3af3416e383 47 uint8_t teapotPacket[14];
TUATBM 0:c3af3416e383 48
TUATBM 0:c3af3416e383 49 // ================================================================
TUATBM 0:c3af3416e383 50 // === INTERRUPT DETECTION ROUTINE ===
TUATBM 0:c3af3416e383 51 // ================================================================
TUATBM 0:c3af3416e383 52
TUATBM 0:c3af3416e383 53 volatile bool mpuInterrupt; // indicates whether MPU interrupt pin has gone high
TUATBM 0:c3af3416e383 54
TUATBM 0:c3af3416e383 55 void dmpDataReady();
TUATBM 0:c3af3416e383 56 void transformeCoordinate_Skipper(Quaternion* q1, Quaternion* q2);
TUATBM 0:c3af3416e383 57 int loopstarting();
TUATBM 0:c3af3416e383 58 void initializeValue();
TUATBM 0:c3af3416e383 59
TUATBM 0:c3af3416e383 60 };
TUATBM 0:c3af3416e383 61
TUATBM 0:c3af3416e383 62 #endif /* _MPU6050_DMP_6_H_ */