k.j
Dependents: 6DoF_IMU_readvalue_thingy 10dof
Fork of ITG3200 by
Diff: ITG3200.cpp
- Revision:
- 1:de82c71cfc08
- Parent:
- 0:8967cbe04d96
--- a/ITG3200.cpp Fri Oct 07 21:08:25 2011 +0000 +++ b/ITG3200.cpp Wed Feb 05 22:12:01 2014 +0000 @@ -211,7 +211,7 @@ } -int ITG3200::getGyroX(void){ +short int ITG3200::getGyroX(void){ char tx = GYRO_XOUT_H_REG; char rx[2]; @@ -220,13 +220,13 @@ i2c_.read((ITG3200_I2C_ADDRESS << 1) | 0x01, rx, 2); - int16_t output = ((int) rx[0] << 8) | ((int) rx[1]); + int16_t output = ((short int) rx[0] << 8) | ((short int) rx[1]); return output; } -int ITG3200::getGyroY(void){ +short int ITG3200::getGyroY(void){ char tx = GYRO_YOUT_H_REG; char rx[2]; @@ -235,13 +235,13 @@ i2c_.read((ITG3200_I2C_ADDRESS << 1) | 0x01, rx, 2); - int16_t output = ((int) rx[0] << 8) | ((int) rx[1]); + int16_t output = ((short int) rx[0] << 8) | ((short int) rx[1]); return output; } -int ITG3200::getGyroZ(void){ +short int ITG3200::getGyroZ(void){ char tx = GYRO_ZOUT_H_REG; char rx[2]; @@ -250,7 +250,7 @@ i2c_.read((ITG3200_I2C_ADDRESS << 1) | 0x01, rx, 2); - int16_t output = ((int) rx[0] << 8) | ((int) rx[1]); + int16_t output = ((short int) rx[0] << 8) | ((short int) rx[1]); return output;