Modified getOffset for calibrating Thermal Drift coefficients.
Fork of ITG3200 by
Modified to make getOffset() function easier to use.
Diff: ITG3200.h
- Revision:
- 4:155c44407af5
- Parent:
- 3:eea9733ca427
- Child:
- 5:0a0315f0f34e
--- a/ITG3200.h Wed Sep 12 14:37:34 2012 +0000 +++ b/ITG3200.h Wed Sep 12 15:23:29 2012 +0000 @@ -242,7 +242,7 @@ * * @return The temperature in raw 16bit integer. */ - int getRawTemperature(void); + int getRawTemperature(void){ return getWord(TEMP_OUT_H_REG); } /** * Get the temperature of the device. @@ -258,7 +258,7 @@ * * @return The output on the x-axis in raw ADC counts. */ - int getGyroX(void); + int getGyroX(void){ return getWord(GYRO_XOUT_H_REG); } /** * Get the output for the y-axis gyroscope. @@ -267,7 +267,7 @@ * * @return The output on the y-axis in raw ADC counts. */ - int getGyroY(void); + int getGyroY(void){ return getWord(GYRO_YOUT_H_REG); } /** * Get the output on the z-axis gyroscope. @@ -276,7 +276,7 @@ * * @return The output on the z-axis in raw ADC counts. */ - int getGyroZ(void); + int getGyroZ(void){ return getWord(GYRO_ZOUT_H_REG); } /** * Burst read the outputs on the x,y,z-axis gyroscope. @@ -393,6 +393,19 @@ void calibrate(double time); protected: + + /** + * Reads a word (2 bytes) from the sensor via I2C bus. + * + * The queried value is assumed big-endian, 2's complement value. + * + * This protected function is added because we shouldn't write getGyroX(), getGyroY() and getGyroZ() + * independently, but collect common codes. + * + * @param regi Register address to be read. + */ + int getWord(int regi); + /** * An internal method to acquire gyro sensor readings before calibration correction. *