Allows for reading accelerometer, gyroscope, and magnetometer data from an LSM9DS0 IMU device
Dependents: uVGA_4180 uLCD_4180_mini ECE4781_Project
Diff: LSM9DS0.h
- Revision:
- 4:bf8f4e7c9905
- Parent:
- 0:1b975a6ae539
--- a/LSM9DS0.h Sun Nov 23 17:46:45 2014 +0000 +++ b/LSM9DS0.h Wed Dec 03 23:08:09 2014 +0000 @@ -1,3 +1,4 @@ +//Most of the Credit goes to jimblom #ifndef _LSM9DS0_H__ #define _LSM9DS0_H__ @@ -175,6 +176,10 @@ int16_t gx, gy, gz; // x, y, and z axis readings of the gyroscope int16_t ax, ay, az; // x, y, and z axis readings of the accelerometer int16_t mx, my, mz; // x, y, and z axis readings of the magnetometer + int16_t temperature; + float abias[3]; + float gbias[3]; + // LSM9DS0 -- LSM9DS0 class constructor // The constructor will set up a handful of private variables, and set the @@ -228,6 +233,12 @@ // those _after_ calling readMag(). void readMag(); + // readTemp() -- Read the temperature output register. + // This function will read two temperature output registers. + // The combined readings are stored in the class' temperature variables. Read + // those _after_ calling readTemp(). + void readTemp(); + // calcGyro() -- Convert from RAW signed 16-bit value to degrees per second // This function reads in a signed 16-bit value and returns the scaled // DPS. This function relies on gScale and gRes being correct. @@ -308,9 +319,12 @@ void configGyroInt(uint8_t int1Cfg, uint16_t int1ThsX = 0, uint16_t int1ThsY = 0, uint16_t int1ThsZ = 0, uint8_t duration = 0); + + void calLSM9DS0(float gbias[3], float abias[3]); + private: - // xmAddress and gAddress store the I2C address or SPI chip select pin + // xmAddress and gAddress store the I2C address // for each sensor. uint8_t xmAddress, gAddress; @@ -427,7 +441,7 @@ /////////////////// // I2C Functions // /////////////////// - I2Cdev* i2c_; + I2Cdev* i2c_; // I2CwriteByte() -- Write a byte out of I2C to a register in the device