aaa

Dependencies:   ArduinoSerial I2Cdev2

Dependents:   AutoFlight2017_now2 AutoFlight2018_Control sbus_test_2018 Autoflight2018_sbusread ... more

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