SSLM1 / Mbed 2 deprecated 2_MPU9250_attitude

Dependencies:   mbed STM32L152withMPU-9250

Revision:
2:bb20d5091065
Parent:
1:61bf659e4a1f
Child:
3:ceb5990f373f
--- a/main.cpp	Sun Jun 07 16:48:13 2015 +0000
+++ b/main.cpp	Tue Sep 01 14:06:00 2015 +0000
@@ -26,6 +26,7 @@
 uint32_t sumCount = 0;
 char buffer[14];
 uint8_t dato_leido[2];
+uint8_t whoami;
 
 int main() {
     
@@ -37,7 +38,7 @@
   t.start(); // Timer ON
   
   // Read the WHO_AM_I register, this is a good test of communication
-  uint8_t whoami = mpu9250.readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250);
+  whoami = mpu9250.readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250);
   
   pc.printf("I AM 0x%x\n\r", whoami); pc.printf("I SHOULD BE 0x71\n\r");
   if (I2Cstate != 0) // error on I2C
@@ -107,8 +108,7 @@
       
         // If intPin goes high, all data registers have new data
         if(mpu9250.readByte(MPU9250_ADDRESS, INT_STATUS) & 0x01) {  // On interrupt, check if data ready interrupt
-            
-            wait(5);        
+              
             mpu9250.readAccelData(accelCount);  // Read the x/y/z adc values   
             // Now we'll calculate the accleration value into actual g's
             if (I2Cstate != 0) //error on I2C
@@ -120,7 +120,6 @@
                 az = (float)accelCount[2]*aRes - accelBias[2];
             }   
             
-            wait(5);
             mpu9250.readGyroData(gyroCount);  // Read the x/y/z adc values
             // Calculate the gyro value into actual degrees per second
             if (I2Cstate != 0) //error on I2C
@@ -132,7 +131,6 @@
                 gz = (float)gyroCount[2]*gRes - gyroBias[2];
             }
             
-            wait(5);
             mpu9250.readMagData(magCount);  // Read the x/y/z adc values   
             // Calculate the magnetometer values in milliGauss
             // Include factory calibration per data sheet and user environmental corrections
@@ -144,8 +142,7 @@
                 my = (float)magCount[1]*mRes*magCalibration[1] - magbias[1];  
                 mz = (float)magCount[2]*mRes*magCalibration[2] - magbias[2];
             }
-            
-            wait(5);            
+                       
             mpu9250.getCompassOrientation(orientation);
         }