only test purpose not official
Diff: LSM9DS1.h
- Revision:
- 6:28c4b3c8b43d
- Parent:
- 4:7ffcb378cfd4
- Child:
- 8:16e88babd42a
--- a/LSM9DS1.h Wed Jun 14 03:28:09 2017 +0000 +++ b/LSM9DS1.h Thu Jun 15 07:17:11 2017 +0000 @@ -195,6 +195,7 @@ int16_t ax_raw, ay_raw, az_raw; // x, y, and z axis readings of the accelerometer int16_t mx_raw, my_raw, mz_raw; // x, y, and z axis readings of the magnetometer int16_t temperature_raw; + int16_t gBiasRaw[3], aBiasRaw[3]; // floating-point values of scaled data in real-world units float gx, gy, gz; @@ -202,7 +203,9 @@ float mx, my, mz; float temperature_c, temperature_f; // temperature in celcius and fahrenheit float intr; + float gBias[3], aBias[3]; + bool autoCalib; /** LSM9DS1 -- LSM9DS1 class constructor * The constructor will set up a handful of private variables, and set the @@ -235,9 +238,9 @@ * gyro, 119 Hz for accelerometer, 80 Hz for magnetometer. * Use the return value of this function to verify communication. */ - uint16_t begin(gyro_scale gScl = G_SCALE_245DPS, + uint16_t begin(gyro_scale gScl = G_SCALE_500DPS, accel_scale aScl = A_SCALE_2G, mag_scale mScl = M_SCALE_4GS, - gyro_odr gODR = G_ODR_119_BW_14, accel_odr aODR = A_ODR_119, + gyro_odr gODR = G_ODR_952_BW_100, accel_odr aODR = A_ODR_119, mag_odr mODR = M_ODR_80); /** readGyro() -- Read the gyroscope output registers. @@ -271,6 +274,10 @@ */ void readTemp(); + /** calibration() -- Calibrate Accel and Gyro sensor + */ + void calibration(); + /** setGyroScale() -- Set the full-scale range of the gyroscope. * This function can be called to set the scale of the gyroscope to * 245, 500, or 2000 degrees per second. @@ -318,7 +325,22 @@ * Must be a value from the mag_odr enum (check above). */ void setMagODR(mag_odr mRate); + + + /** enableFIFO() -- Turn on FIFO state (CTRL_REG9) + * Input: + * - enable = true - turn on FIFO + * false - turn off FIFO + */ + void enableXgFIFO(bool enable); + /** setFIFO() -- Set FIFO mode and FIFO threshold(FIFO_CTRL) + * Input: + * - fifoMode = 0: Bypass mode. FIFO turned off + * 1: FIFO mode. Stops collecting data when FIFO is full + * - fifoThs = maximum threshold is 0x1F(31) + */ + void setXgFIFO(uint8_t fifoMode, uint8_t fifoThs); private: /** xgAddress and mAddress store the I2C address