Not a real MPU6050 but imc-20689

Fork of MPU6050 by Erik -

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Mon Sep 10 21:22:39 2012 +0000
Parent:
0:6757f7363a9f
Child:
2:5c63e20c50f3
Commit message:
v0.1

Changed in this revision

MODI2C.lib Show diff for this revision Revisions of this file
MPU6050.cpp Show annotated file Show diff for this revision Revisions of this file
MPU6050.h Show annotated file Show diff for this revision Revisions of this file
--- a/MODI2C.lib	Wed Jul 11 12:26:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/Sissors/libraries/MODI2C/mcfitx
\ No newline at end of file
--- a/MPU6050.cpp	Wed Jul 11 12:26:47 2012 +0000
+++ b/MPU6050.cpp	Mon Sep 10 21:22:39 2012 +0000
@@ -196,22 +196,22 @@
 void MPU6050::getGyro( float *data ) {
     int temp[3];
     this->getGyroRaw(temp);
-    if (currentAcceleroRange == MPU6050_GYRO_RANGE_250) {
+    if (currentGyroRange == MPU6050_GYRO_RANGE_250) {
         data[0]=(float)temp[0] / 7505.7;
         data[1]=(float)temp[1] / 7505.7;
         data[2]=(float)temp[2] / 7505.7;
         }
-    if (currentAcceleroRange == MPU6050_GYRO_RANGE_500){
+    if (currentGyroRange == MPU6050_GYRO_RANGE_500){
         data[0]=(float)temp[0] / 3752.9;
         data[1]=(float)temp[1] / 3752.9;
         data[2]=(float)temp[2] / 3752.9;
         }
-    if (currentAcceleroRange == MPU6050_GYRO_RANGE_1000){
+    if (currentGyroRange == MPU6050_GYRO_RANGE_1000){
         data[0]=(float)temp[0] / 1879.3;;
         data[1]=(float)temp[1] / 1879.3;
         data[2]=(float)temp[2] / 1879.3;
         }
-    if (currentAcceleroRange == MPU6050_GYRO_RANGE_2000){
+    if (currentGyroRange == MPU6050_GYRO_RANGE_2000){
         data[0]=(float)temp[0] / 939.7;
         data[1]=(float)temp[1] / 939.7;
         data[2]=(float)temp[2] / 939.7;
--- a/MPU6050.h	Wed Jul 11 12:26:47 2012 +0000
+++ b/MPU6050.h	Mon Sep 10 21:22:39 2012 +0000
@@ -1,17 +1,4 @@
-/*My first library, and it only contains the basic what I required personally (or could be bothered to add)
-WARNING: This does NOT include the IMU capabilities of the MPU6050. Simply because there is no register map available required for that,
-it is not added to this library. You can google for some reverse engineered code, but that does not give you any idea what is going on. 
-
-
-Thanks to Uwe Gartman for having a nice example of a similar library (http://mbed.org/users/Digixx/libraries/ITG3200/lyptff)
-
-If you want a more complete library, check: https://github.com/jrowberg/i2cdevlib/tree/master/MPU6050
-This library contains alot less, but that also makes it less confusing ;) 
-
-Large goal for me was getting experience with making libraries, which is a reason I did not copy the one from github (and adapt it for mbed). But if you just want to use the accelero
-and gyroscope of this IC with a few settings, this library should be an easy choice.
-
-Use #define MPU6050_ES before you include this file if you have an engineering sample (older EVBs will have them), to find out if you have one, check your accelerometer output. 
+/*Use #define MPU6050_ES before you include this file if you have an engineering sample (older EVBs will have them), to find out if you have one, check your accelerometer output. 
 If it is half of what you expected, and you still are on the correct planet, you got an engineering sample
 */
 
@@ -23,12 +10,15 @@
  * Includes
  */
 #include "mbed.h"
-#include "MODI2C.h"
+
 
 /**
  * Defines
  */
-#define MPU6050_ADDRESS             0x69 // address pin low (GND), default for InvenSense evaluation board
+#ifndef MPU6050_ADDRESS
+    #define MPU6050_ADDRESS             0x69 // address pin low (GND), default for InvenSense evaluation board
+#endif
+
 #ifdef MPU6050_ES
         #define DOUBLE_ACCELERO
 #endif  
@@ -266,7 +256,7 @@
         
      private:
 
-     MODI2C connection;
+     I2C connection;
      char currentAcceleroRange;
      char currentGyroRange;