v1

Dependents:   Poloytech_Notes

Fork of MPU6050 by Erik -

Files at this revision

API Documentation at this revision

Comitter:
fadi_lad
Date:
Thu Mar 09 17:00:02 2017 +0000
Parent:
3:0a077b7133e6
Commit message:
hello

Changed in this revision

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
diff -r 0a077b7133e6 -r d477e0b6630a MPU6050.cpp
--- a/MPU6050.cpp	Fri Feb 17 07:47:38 2017 +0000
+++ b/MPU6050.cpp	Thu Mar 09 17:00:02 2017 +0000
@@ -117,28 +117,28 @@
     data[2] = (int)(short)((temp[4]<<8) + temp[5]);
 }
 
-void MPU6050::getAccelero( float *data ) {
+void MPU6050::getAccelero( int *data ) {
     int temp[3];
     this->getAcceleroRaw(temp);
     if (currentAcceleroRange == MPU6050_ACCELERO_RANGE_2G) {
-        data[0]=(float)temp[0] / 16384.0 * 9.81;
-        data[1]=(float)temp[1] / 16384.0 * 9.81;
-        data[2]=(float)temp[2] / 16384.0 * 9.81;
+        data[0]= temp[0] ;//(float)temp[0] / 16384.0 * 9.81;
+        data[1]= temp[1] ;//(float)temp[1] / 16384.0 * 9.81;
+        data[2]= temp[2] ;//(float)temp[2] / 16384.0 * 9.81;
         }
     if (currentAcceleroRange == MPU6050_ACCELERO_RANGE_4G){
-        data[0]=(float)temp[0] / 8192.0 * 9.81;
-        data[1]=(float)temp[1] / 8192.0 * 9.81;
-        data[2]=(float)temp[2] / 8192.0 * 9.81;
+        data[0]= temp[0] ;//(float)temp[0] / 8192.0 * 9.81;
+        data[1]= temp[1] ;//(float)temp[1] / 8192.0 * 9.81;
+        data[2]= temp[2] ;//(float)temp[2] / 8192.0 * 9.81;
         }
     if (currentAcceleroRange == MPU6050_ACCELERO_RANGE_8G){
-        data[0]=(float)temp[0] / 4096.0 * 9.81;
-        data[1]=(float)temp[1] / 4096.0 * 9.81;
-        data[2]=(float)temp[2] / 4096.0 * 9.81;
+        data[0]= temp[0] ; //(float)temp[0] / 4096.0 * 9.81;
+        data[1]= temp[1] ; //(float)temp[1] / 4096.0 * 9.81;
+        data[2]= temp[2] ; //(float)temp[2] / 4096.0 * 9.81;
         }
     if (currentAcceleroRange == MPU6050_ACCELERO_RANGE_16G){
-        data[0]=(float)temp[0] / 2048.0 * 9.81;
-        data[1]=(float)temp[1] / 2048.0 * 9.81;
-        data[2]=(float)temp[2] / 2048.0 * 9.81;
+        data[0]= temp[0] ; //(float)temp[0] / 2048.0 * 9.81;
+        data[1]= temp[1] ; //(float)temp[1] / 2048.0 * 9.81;
+        data[2]= temp[2] ; //(float)temp[2] / 2048.0 * 9.81;
         }
     
     #ifdef DOUBLE_ACCELERO
@@ -193,28 +193,28 @@
     data[2] = (int)(short)((temp[4]<<8) + temp[5]);
 }
 
-void MPU6050::getGyro( float *data ) {
+void MPU6050::getGyro( int *data ) {
     int temp[3];
     this->getGyroRaw(temp);
     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;
+        data[0]= temp[0] ;//(float)temp[0] / 7505.7;
+        data[1]= temp[1] ;//(float)temp[1] / 7505.7;
+        data[2]= temp[2] ;//(float)temp[2] / 7505.7;
         }
     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;
+        data[0]= temp[0] ;//(float)temp[0] / 3752.9;
+        data[1]= temp[1] ;//(float)temp[1] / 3752.9;
+        data[2]= temp[2] ;//(float)temp[2] / 3752.9;
         }
     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;
+        data[0]=temp[0] ;//(float)temp[0] / 1879.3;;
+        data[1]=temp[1] ;//(float)temp[1] / 1879.3;
+        data[2]=temp[2] ;//(float)temp[2] / 1879.3;
         }
     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;
+        data[0]= temp[0] ; //(float)temp[0] / 939.7;
+        data[1]= temp[1] ;//(float)temp[1] / 939.7;
+        data[2]= temp[2] ;//(float)temp[2] / 939.7;
         }
 }
 //--------------------------------------------------
diff -r 0a077b7133e6 -r d477e0b6630a MPU6050.h
--- a/MPU6050.h	Fri Feb 17 07:47:38 2017 +0000
+++ b/MPU6050.h	Thu Mar 09 17:00:02 2017 +0000
@@ -162,7 +162,7 @@
      *
      * @param data - pointer to float array with length three: data[0] = X, data[1] = Y, data[2] = Z
      */   
-     void getAccelero( float *data );
+     void getAccelero( int *data );
      
      /**
      * Sets the Gyro full-scale range
@@ -208,7 +208,7 @@
      *
      * @param data - pointer to float array with length three: data[0] = X, data[1] = Y, data[2] = Z
      */   
-     void getGyro( float *data);     
+     void getGyro( int *data);     
      
      /**
      * Reads temperature data.