Mitrank Shah / MPU9250
Revision:
1:f650800728d8
Parent:
0:8a0a9422787d
--- a/MPU9250.h	Thu Aug 17 07:54:41 2017 +0000
+++ b/MPU9250.h	Fri May 06 17:12:42 2022 +0000
@@ -190,14 +190,14 @@
 float aRes, gRes, mRes;      // scale resolutions per LSB for the sensors
 
 //Set up I2C, (SDA,SCL)
-//I2C i2c(I2C_SDA, I2C_SCL);
+I2C i2c(I2C_SDA, I2C_SCL);
 //I2C i2c(P0_0, P0_1); // nRF51 FC
 //I2C i2c(P0_6, P0_7); // nRF52 QFN dev board
-I2C i2c(P0_30, P0_28); // nRF52 CIAA dev board
+//I2C i2c(P0_30, P0_28); // nRF52 CIAA dev board
 
 //DigitalOut myled(P0_19); // mbed kit
 //DigitalOut myled(P0_18);  // nRF51822 module
-DigitalOut myled(P0_24);  // nRF52832 module
+//DigitalOut myled(P0_24);  // nRF52832 module
     
 // Pin definitions
 bool newData = false;
@@ -645,7 +645,7 @@
     mag_scale[2]  = (mag_max[2] - mag_min[2])/2;  // get average z axis max chord length in counts
 
     float avg_rad = mag_scale[0] + mag_scale[1] + mag_scale[2];
-    avg_rad /= 3.0;
+    avg_rad /= 3.0f;
 
     dest2[0] = avg_rad/((float)mag_scale[0]);
     dest2[1] = avg_rad/((float)mag_scale[1]);
@@ -723,12 +723,12 @@
    selfTest[5] = readByte(MPU9250_ADDRESS, SELF_TEST_Z_GYRO); // Z-axis gyro self-test results
 
   // Retrieve factory self-test value from self-test code reads
-   factoryTrim[0] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[0] - 1.0) )); // FT[Xa] factory trim calculation
-   factoryTrim[1] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[1] - 1.0) )); // FT[Ya] factory trim calculation
-   factoryTrim[2] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[2] - 1.0) )); // FT[Za] factory trim calculation
-   factoryTrim[3] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[3] - 1.0) )); // FT[Xg] factory trim calculation
-   factoryTrim[4] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[4] - 1.0) )); // FT[Yg] factory trim calculation
-   factoryTrim[5] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[5] - 1.0) )); // FT[Zg] factory trim calculation
+   factoryTrim[0] = (float)(2620/1<<FS)*(pow( 1.01f , ((float)selfTest[0] - 1.0f) )); // FT[Xa] factory trim calculation
+   factoryTrim[1] = (float)(2620/1<<FS)*(pow( 1.01f , ((float)selfTest[1] - 1.0f) )); // FT[Ya] factory trim calculation
+   factoryTrim[2] = (float)(2620/1<<FS)*(pow( 1.01f , ((float)selfTest[2] - 1.0f) )); // FT[Za] factory trim calculation
+   factoryTrim[3] = (float)(2620/1<<FS)*(pow( 1.01f , ((float)selfTest[3] - 1.0f) )); // FT[Xg] factory trim calculation
+   factoryTrim[4] = (float)(2620/1<<FS)*(pow( 1.01f , ((float)selfTest[4] - 1.0f) )); // FT[Yg] factory trim calculation
+   factoryTrim[5] = (float)(2620/1<<FS)*(pow( 1.01f , ((float)selfTest[5] - 1.0f) )); // FT[Zg] factory trim calculation
  
  // Report results as a ratio of (STR - FT)/FT; the change from Factory Trim of the Self-Test Response
  // To get percent, must multiply by 100