Claudio Donate / ITG3200

Dependents:   KalmanFilter

Fork of ITG3200 by Claudio Donate

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ITG3200.h Source File

ITG3200.h

00001 #pragma once
00002 
00003 //I2C address is either 0x68 or 0x69 , depending on pin AD0, check block diagram for your device
00004 #define ITG3200_ADRESS 0x69
00005 
00006 //Convert gyro raw data to radians per second, 1 degree/s = 0,017453293 rad/s.
00007 //The value is 0,017453293/LSB (+- 250 degrees/s)
00008 
00009 //const float fConvRPS= 2.6646248854961832061068702290076e-4; //For +- 500 degrees/s
00010 //const float fConvRPS= 1.2141420883e-3; //For +- 2000 degrees/s
00011 
00012 const float fConvRPS= 1.3323124427480916030534351145038e-4; //For +- 250 degrees/s
00013 
00014 class ITG3200 {
00015 protected:
00016     I2C & I2CBus;
00017     Timer & GlobalTime;
00018 
00019 public:
00020     //Offset
00021     float Offset[3];
00022 
00023     //Rotational speed around all three axes
00024     short RawRate[3];       //Raw data
00025     float Rate[3];          //Calibrated rotation rate in radians per second
00026 
00027 
00028     //Initialization
00029     ITG3200(I2C & I2CBus_, Timer & GlobalTime_);
00030     void Init();
00031 
00032 
00033 private:
00034     //Read raw data
00035     void ReadRawData();
00036 
00037 public:
00038     //Update Method
00039     void Update();
00040     char getInfo(void);
00041 
00042     //Calibration
00043     void Calibrate(int ms);
00044 };