Chengwei Zhang / Mbed 2 deprecated MPU6050-DMP_test_JJ

Dependencies:   MPU6050-DMP mbed

Fork of MPU6050-DMP_test by Match Lab

Files at this revision

API Documentation at this revision

Comitter:
zcw607
Date:
Thu Feb 26 04:02:36 2015 +0000
Parent:
2:7ef42101b204
Commit message:
test modified library

Changed in this revision

MPU6050-DMP-Ian.lib Show annotated file Show diff for this revision Revisions of this file
config.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MPU6050-DMP-Ian.lib	Sun Feb 22 03:09:44 2015 +0000
+++ b/MPU6050-DMP-Ian.lib	Thu Feb 26 04:02:36 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/pHysiX/code/MPU6050-DMP-Ian/#86afc8447df9
+http://developer.mbed.org/users/zcw607/code/MPU6050-DMP/#4d3c598e3719
--- a/config.h	Sun Feb 22 03:09:44 2015 +0000
+++ b/config.h	Thu Feb 26 04:02:36 2015 +0000
@@ -15,4 +15,4 @@
 // But other value doesn't yet support.
 #define MPU6050_ACCEL_FS MPU6050_ACCEL_FS_2
 
-#define PC_BAUDRATE 921600
\ No newline at end of file
+#define PC_BAUDRATE 115200
\ No newline at end of file
--- a/main.cpp	Sun Feb 22 03:09:44 2015 +0000
+++ b/main.cpp	Thu Feb 26 04:02:36 2015 +0000
@@ -31,8 +31,8 @@
 
 
 RawSerial pc(USBTX, USBRX);
-MPU6050 mpu(dp5, dp27);     // sda, scl pin
-InterruptIn INT0(dp13);     // INT0 pin
+MPU6050 mpu(P0_20, P0_22);     // sda, scl pin
+InterruptIn INT0(P0_21);     // INT0 pin
 
 const int FIFO_BUFFER_SIZE = 128;
 uint8_t fifoBuffer[FIFO_BUFFER_SIZE];
@@ -74,7 +74,15 @@
     INT0.mode(PullDown);
     INT0.fall(dmpDataUpdate);
     
-    mpu.initialize();
+    //mpu.initialize();
+    
+    mpu.setClockSource(MPU6050_CLOCK_PLL_ZGYRO);
+    mpu.setFullScaleGyroRange(MPU6050_GYRO_FS_2000);
+    mpu.setFullScaleAccelRange(MPU6050_ACCEL_FS_2);
+    mpu.setDLPFMode(MPU6050_DLPF_BW_20);  //10,20,42,98,188
+    mpu.setRate(4);   // 0=1khz 1=500hz, 2=333hz, 3=250hz 4=200hz
+    mpu.setSleepEnabled(false);
+    
     if (mpu.testConnection()) {
         pc.puts("MPU6050 test connection passed.\n");
     } else {