Added external magnetometer functionality
Dependencies: HMC58X31 MODI2C MPU6050 MS561101BA
Fork of FreeIMU by
Diff: FreeIMU.cpp
- Revision:
- 13:21b275eeeda2
- Parent:
- 9:a79af1283446
- Child:
- 15:ea86489d606b
--- a/FreeIMU.cpp Mon Feb 10 01:13:34 2014 +0000 +++ b/FreeIMU.cpp Thu Sep 18 08:43:06 2014 +0000 @@ -95,6 +95,11 @@ } +void FreeIMU::sample(bool sampling) +{ + accgyro->sample(sampling); +} + /** * Initialize the FreeIMU I2C bus, sensors and performs gyro offsets calibration */ @@ -393,12 +398,12 @@ * * @param q the quaternion to populate */ + +float val[9]; void FreeIMU::getQ(float * q) { - float val[9]; getValues(val); - //now = micros(); dt_us=update.read_us(); sampleFreq = 1.0 / ((dt_us) / 1000000.0); update.reset(); @@ -415,6 +420,13 @@ } } +//XYZ +void FreeIMU::getRate(float * r) +{ + r[0] = val[5]; //Yaw + r[1] = val[3]; //Pitch + r[2] = val[4]; //Roll +} const float def_sea_press = 1013.25;