Forked from Aaron Berk's ITG3200 driver class library, customized for my specific application using 9DoF-Stick by Sparkfun.
Fork of ITG3200 by
ITG-3200 is triple axis, digital interface, gyro sensor.
This library is forked from Aaron Berk's work.
This library is for specific application using 9DoF-Stick.
Datasheet:
http://invensense.com/mems/gyro/documents/PS-ITG-3200-00-01.4.pdf
This library has a feature to correct thermal drift of the device. For details, see Thermal Drift.
ITG-3200は3軸のデジタルインターフェースを備えたジャイロセンサです。
このライブラリは 9DoF-Stick を使用した特定の企画のために保守しています。
mbed IDEが日本語をサポートするまでは英語でコメントを書いていきますが、サポートした後もきっと英語で書いていくでしょう。
このライブラリはデバイスの熱ドリフトを補正する機能を持っています。詳しくは Thermal Drift。
Diff: ITG3200.h
- Revision:
- 4:155c44407af5
- Parent:
- 3:eea9733ca427
- Child:
- 5:0a0315f0f34e
diff -r eea9733ca427 -r 155c44407af5 ITG3200.h --- 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. *