Tyler Weaver / ITG3200

Dependents:   9Dof_unit_testing

Fork of ITG3200 by James Watanabe

Revision:
12:d624e9c6dae7
Parent:
11:9a354f34d8e3
Child:
13:e886466d7d67
--- a/ITG3200.cpp	Wed Oct 31 15:42:01 2012 +0000
+++ b/ITG3200.cpp	Tue Nov 06 17:31:49 2012 +0000
@@ -68,7 +68,12 @@
     tx[1] = 0x03 << 3;
 
     i2c_.write((ITG3200_I2C_ADDRESS << 1) & 0xFE, tx, 2);
+    
+    const float offset[3] = {99.5, -45.0, -29.7}; // taken from itg3200.xls curve fit test
+    const float slope[3] = {-1.05, 0.95, 0.47};
 
+    setCalibrationCurve(offset, slope);
+    setLpBandwidth(LPFBW_5HZ); // lowest rate low-pass filter
 }
 
 void ITG3200::setCalibrationCurve(const float offset[3], const float slope[3])
@@ -254,7 +259,7 @@
 
 }
 
-void ITG3200::getRawGyroXYZ(int readings[3])
+void ITG3200::getRawXYZ(int readings[3])
 {
 
     char tx = GYRO_XOUT_H_REG;
@@ -268,9 +273,9 @@
         readings[i] = swapExtend(&rx[i * 2]);
 }
 
-void ITG3200::getGyroXYZ(int readings[3], Correction corr)
+void ITG3200::getXYZ(int16_t readings[3], Correction corr)
 {
-    getRawGyroXYZ(readings);
+    getRawXYZ(readings);
     switch(corr) {
         case OffsetCorrection:
             for(int i = 0; i < 3; i++)
@@ -319,7 +324,7 @@
     t.start();
     while(t.read() < time) {
         int gyro[3];
-        getRawGyroXYZ(gyro);
+        getRawXYZ(gyro);
         for(int i = 0; i < 3; i++)
             sum[i] += gyro[i];
         sumCount++;