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.cpp
- Revision:
- 4:155c44407af5
- Parent:
- 3:eea9733ca427
- Child:
- 5:0a0315f0f34e
diff -r eea9733ca427 -r 155c44407af5 ITG3200.cpp --- a/ITG3200.cpp Wed Sep 12 14:37:34 2012 +0000 +++ b/ITG3200.cpp Wed Sep 12 15:23:29 2012 +0000 @@ -1,4 +1,5 @@ /** + * @file ITG3200.cpp * @author Aaron Berk * * @section LICENSE @@ -195,9 +196,9 @@ } -int ITG3200::getRawTemperature(void){ +int ITG3200::getWord(int regi){ - char tx = TEMP_OUT_H_REG; + char tx = regi; char rx[2]; i2c_.write(I2C_ADDRESS, &tx, 1); @@ -220,51 +221,6 @@ } -int ITG3200::getGyroX(void){ - - char tx = GYRO_XOUT_H_REG; - char rx[2]; - - i2c_.write((ITG3200_I2C_ADDRESS << 1) & 0xFE, &tx, 1); - - i2c_.read((ITG3200_I2C_ADDRESS << 1) | 0x01, rx, 2); - - int16_t output = ((int) rx[0] << 8) | ((int) rx[1]); - - return output; - -} - -int ITG3200::getGyroY(void){ - - char tx = GYRO_YOUT_H_REG; - char rx[2]; - - i2c_.write((ITG3200_I2C_ADDRESS << 1) & 0xFE, &tx, 1); - - i2c_.read((ITG3200_I2C_ADDRESS << 1) | 0x01, rx, 2); - - int16_t output = ((int) rx[0] << 8) | ((int) rx[1]); - - return output; - -} - -int ITG3200::getGyroZ(void){ - - char tx = GYRO_ZOUT_H_REG; - char rx[2]; - - i2c_.write((ITG3200_I2C_ADDRESS << 1) & 0xFE, &tx, 1); - - i2c_.read((ITG3200_I2C_ADDRESS << 1) | 0x01, rx, 2); - - int16_t output = ((int) rx[0] << 8) | ((int) rx[1]); - - return output; - -} - void ITG3200::getRawGyroXYZ(int readings[3]){ char tx = GYRO_XOUT_H_REG;