Library for Bosch Sensortec BMI160 IMU
Dependents: Rocket MAX32630FTHR_JOYSTICK MAX32630FTHR_IMU_Hello_World Pike_the_Flipper_Main_Branch ... more
Fork of BMI160 by
Diff: bmi160.h
- Revision:
- 13:5d132f873b07
- Parent:
- 12:64931a80340d
- Child:
- 14:646eb94fa2eb
--- a/bmi160.h Tue Dec 20 18:38:42 2016 +0000 +++ b/bmi160.h Tue Dec 20 19:02:36 2016 +0000 @@ -56,7 +56,7 @@ ///Return value on success. static const uint8_t RTN_NO_ERROR = 0; - ///BMI160 Sensors + ///Sensor types enum Sensors { MAG = 0, ///<Optional external sensor @@ -87,6 +87,7 @@ AxisData zAxis; ///<Sensor Z axis data }; + ///BMI160 registers enum Registers { @@ -201,15 +202,17 @@ }; - ///@name ERR_REG(0x02) Group - ///Bit masks, positions, and enumerations + ///@name ERR_REG(0x02) + ///Error register data ///@{ + static const uint8_t FATAL_ERR = 0x01; static const uint8_t ERR_CODE = 0x1E; static const uint8_t I2C_FAIL_ERR = 0x20; static const uint8_t DROP_CMD_ERR = 0x40; static const uint8_t MAG_DRDY_ERR = 0x80; + ///Enumerated error codes enum ErrorCodes { NO_ERROR = 0, ///<No Error @@ -224,16 +227,18 @@ ///@} - ///@name ACC_CONF(0x40) and ACC_RANGE(0x41) Group - ///Bit masks, positions, and enumerations + ///@name ACC_CONF(0x40) and ACC_RANGE(0x41) + ///Data for configuring accelerometer ///@{ - static const uint8_t ACC_ODR = 0x0F; - static const uint8_t ACC_ODR_POS = 0; - static const uint8_t ACC_BWP = 0x70; + + static const uint8_t ACC_ODR_MASK = 0x0F; + static const uint8_t ACC_ODR_POS = 0x00; + static const uint8_t ACC_BWP_MASK = 0x70; static const uint8_t ACC_BWP_POS = 0x04; - static const uint8_t ACC_US = 0x80; + static const uint8_t ACC_US_MASK = 0x80; static const uint8_t ACC_US_POS = 0x07; + ///Accelerometer output data rates enum AccOutPutDataRate { ACC_ODR_1 = 1, ///< 25/32Hz @@ -250,6 +255,7 @@ ACC_ODR_12 ///< 1600Hz }; + ///Accelerometer bandwidth parameters enum AccBandWidthParam { ACC_BWP_0 = 0, ///< Average 1 cycle @@ -262,12 +268,14 @@ ACC_BWP_7 ///< Average 128 cycles }; + ///Accelerometer undersampling enum AccUnderSampling { ACC_US_OFF = 0, ACC_US_ON }; + ///Accelerometer ranges enum AccRange { SENS_2G = 0, ///<Accelerometer range +-2G @@ -276,6 +284,7 @@ SENS_16G, ///<Accelerometer range +-16G }; + ///Accelerometer configuration data structure struct AccConfig { AccRange range; @@ -284,10 +293,12 @@ AccOutPutDataRate odr; }; + ///Accelerometer default configuration static const AccConfig DEFAULT_ACC_CONFIG; ///@} + ///Enumerated power modes enum PowerModes { SUSPEND = 0, ///<Acc and Gyro, No sampling, No FIFO data readout @@ -297,6 +308,7 @@ }; + ///Enumerated commands used with CMD register enum Commands { START_FOC = 0x03, ///<Starts Fast Offset Calibrartion