forked

Dependencies:   PinDetect

Fork of LSM9DS1_Library_cal by jim hamblen

Files at this revision

API Documentation at this revision

Comitter:
nghiajenius_dev
Date:
Tue Sep 26 07:59:21 2017 +0000
Parent:
2:36abf8e18ade
Commit message:
uart0

Changed in this revision

LSM9DS1.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
--- a/LSM9DS1.cpp	Wed Feb 03 18:45:40 2016 +0000
+++ b/LSM9DS1.cpp	Tue Sep 26 07:59:21 2017 +0000
@@ -36,7 +36,7 @@
 #define LSM9DS1_COMMUNICATION_TIMEOUT 1000
 
 float magSensitivity[4] = {0.00014, 0.00029, 0.00043, 0.00058};
-extern Serial pc;
+extern Serial uart0;
 
 LSM9DS1::LSM9DS1(PinName sda, PinName scl, uint8_t xgAddr, uint8_t mAddr)
     :i2c(sda, scl)
@@ -169,7 +169,7 @@
     // each device. Store those in a variable so we can return them.
     uint8_t mTest = mReadByte(WHO_AM_I_M);      // Read the gyro WHO_AM_I
     uint8_t xgTest = xgReadByte(WHO_AM_I_XG);   // Read the accel/mag WHO_AM_I
-    pc.printf("%x, %x, %x, %x\n\r", mTest, xgTest, _xgAddress, _mAddress);
+    uart0.printf("%x, %x, %x, %x\n\r", mTest, xgTest, _xgAddress, _mAddress);
     uint16_t whoAmICombined = (xgTest << 8) | mTest;
 
     if (whoAmICombined != ((WHO_AM_I_AG_RSP << 8) | WHO_AM_I_M_RSP))
@@ -331,7 +331,7 @@
     int ii;
     int32_t aBiasRawTemp[3] = {0, 0, 0};
     int32_t gBiasRawTemp[3] = {0, 0, 0};
-    pc.printf("\n\rPlace IMU on level surface and do not move it for gyro and accel calibration.\n\r");
+    uart0.printf("\n\rPlace IMU on level surface and do not move it for gyro and accel calibration.\n\r");
     wait(1);
     // Turn on FIFO and set threshold to 32 samples
     enableFIFO(true);
@@ -368,7 +368,7 @@
     int i, j;
     int16_t magMin[3] = {0, 0, 0};
     int16_t magMax[3] = {0, 0, 0}; // The road warrior
-    pc.printf("\n\n\r Rotate IMU device at least 360 in horizontal plane for magnetometer calibration\n\r");
+    uart0.printf("\n\n\r Rotate IMU device at least 360 in horizontal plane for magnetometer calibration\n\r");
     wait(0.5);
     for (i=0; i<1000; i++) {
         while (!magAvailable(ALL_AXIS));
@@ -385,11 +385,11 @@
     for (j = 0; j < 3; j++) {
         mBiasRaw[j] = (magMax[j] + magMin[j]) / 2;
         mBias[j] = calcMag(mBiasRaw[j]);
-        pc.printf("%f  ",mBias[j]);
+        uart0.printf("%f  ",mBias[j]);
         if (loadIn)
             magOffset(j, mBiasRaw[j]);
     }
-    pc.printf("\n\rMAG calibration done\n\r");
+    uart0.printf("\n\rMAG calibration done\n\r");
 }
 void LSM9DS1::magOffset(uint8_t axis, int16_t offset)
 {
@@ -961,7 +961,7 @@
     // Whether we're using I2C or SPI, write a byte using the
     // gyro-specific I2C address or SPI CS pin.
     if (settings.device.commInterface == IMU_MODE_I2C) {
-        pc.printf("yo");
+        uart0.printf("yo");
         I2CwriteByte(_xgAddress, subAddress, data);
     } else if (settings.device.commInterface == IMU_MODE_SPI) {
         SPIwriteByte(_xgAddress, subAddress, data);
@@ -973,7 +973,7 @@
     // Whether we're using I2C or SPI, write a byte using the
     // accelerometer-specific I2C address or SPI CS pin.
     if (settings.device.commInterface == IMU_MODE_I2C) {
-        pc.printf("mo");
+        uart0.printf("mo");
         return I2CwriteByte(_mAddress, subAddress, data);
     } else if (settings.device.commInterface == IMU_MODE_SPI)
         return SPIwriteByte(_mAddress, subAddress, data);
--- a/mbed.bld	Wed Feb 03 18:45:40 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file