Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Host_Software_MAX32664GWEB_HR_wrist Host_Software_MAX32664GWEC_SpO2_HR Host_Software_MAX32664GWEB_HR_EXTENDED Host_Software_MAX32664GWEC_SpO2_HR-_EXTE ... more
Diff: bmi160.h
- Revision:
- 12:64931a80340d
- Parent:
- 11:24602ff07e9f
- Child:
- 13:5d132f873b07
diff -r 24602ff07e9f -r 64931a80340d bmi160.h
--- a/bmi160.h Tue Dec 20 01:29:56 2016 +0000
+++ b/bmi160.h Tue Dec 20 18:38:42 2016 +0000
@@ -201,18 +201,15 @@
};
- ///ERR_REG Bit Mask bit0
+ ///@name ERR_REG(0x02) Group
+ ///Bit masks, positions, and enumerations
+ ///@{
static const uint8_t FATAL_ERR = 0x01;
- ///ERR_REG Bit Mask bits4:1
static const uint8_t ERR_CODE = 0x1E;
- ///ERR_REG Bit Mask bit5
static const uint8_t I2C_FAIL_ERR = 0x20;
- ///ERR_REG Bit Mask bit6
static const uint8_t DROP_CMD_ERR = 0x40;
- ///ERR_REG Bit Mask bit7
static const uint8_t MAG_DRDY_ERR = 0x80;
- ///ERR_REG bits4:1 codes
enum ErrorCodes
{
NO_ERROR = 0, ///<No Error
@@ -224,16 +221,19 @@
///<not match
PFD_USED_LPM ///<Pre-filtered data are used in low power mode
};
+ ///@}
- ///ACC_CONF Bit Mask bits3:0
+ ///@name ACC_CONF(0x40) and ACC_RANGE(0x41) Group
+ ///Bit masks, positions, and enumerations
+ ///@{
static const uint8_t ACC_ODR = 0x0F;
- ///ACC_CONF Bit Mask bits6:4
+ static const uint8_t ACC_ODR_POS = 0;
static const uint8_t ACC_BWP = 0x70;
- ///ACC_CONF Bit Mask bit7
+ static const uint8_t ACC_BWP_POS = 0x04;
static const uint8_t ACC_US = 0x80;
+ static const uint8_t ACC_US_POS = 0x07;
- ///ACC_CONF bits3:0 codes
enum AccOutPutDataRate
{
ACC_ODR_1 = 1, ///< 25/32Hz
@@ -250,7 +250,6 @@
ACC_ODR_12 ///< 1600Hz
};
- ///ACC_CONF bits6:4 codes
enum AccBandWidthParam
{
ACC_BWP_0 = 0, ///< Average 1 cycle
@@ -263,14 +262,12 @@
ACC_BWP_7 ///< Average 128 cycles
};
- ///ACC_CONF bit7
enum AccUnderSampling
{
ACC_US_OFF = 0,
ACC_US_ON
};
- ///Accelerometer range values
enum AccRange
{
SENS_2G = 0, ///<Accelerometer range +-2G
@@ -279,7 +276,6 @@
SENS_16G, ///<Accelerometer range +-16G
};
- ///Structure for holding accelerometer configuration
struct AccConfig
{
AccRange range;
@@ -288,10 +284,10 @@
AccOutPutDataRate odr;
};
- ///Accelerometer default configuration
static const AccConfig DEFAULT_ACC_CONFIG;
+ ///@}
- ///BMI160 Power Modes
+
enum PowerModes
{
SUSPEND = 0, ///<Acc and Gyro, No sampling, No FIFO data readout
@@ -300,7 +296,7 @@
FAST_START_UP ///<Gyro start up delay time to normal mode <= 10 ms
};
- ///BMI160 Commands for CMD register
+
enum Commands
{
START_FOC = 0x03, ///<Starts Fast Offset Calibrartion
@@ -402,28 +398,16 @@
int32_t setSensorPowerMode(Sensors sensor, PowerModes pwrMode);
- ///@brief Get die temperature.\n
+ ///@brief Configure Accelerometer.\n
///
///On Entry:
- ///@param[in] temp - pointer to float for temperature
+ ///@param[in] config - Accelerometer configuration
///
///On Exit:
- ///@param[out] temp - on success, holds the die temperature
+ ///@param[out] none
///
///@returns 0 on success, non 0 on failure
- int32_t getTemperature(float *temp);
-
-
- ///@brief Read data registers and sensortime.\n
- ///
- ///On Entry:
- ///@param[in] data - buffer at least 23 bytes long
- ///
- ///On Exit:
- ///@param[out] data - holds raw sensor data on success
- ///
- ///@returns 0 on success, non 0 on failure
- int32_t getSensorDataAndTime(uint8_t *data);
+ int32_t setAccConfig(const AccConfig &config);
///@brief Get accelerometer axis as float.\n
@@ -431,26 +415,26 @@
///On Entry:
///@param[in] axis - Sensor axis
///@param[in] data - AxisData structure
- ///@param[in] accConfig - Accelerometer configuration structure
+ ///@param[in] range - Accelerometer range
///
///On Exit:
///@param[out] data - Structure holds raw and scaled axis data
///
///@returns 0 on success, non 0 on failure
- int32_t getAccAxis(SensorAxis axis, AxisData &data, AccConfig accConfig);
+ int32_t getAccAxis(SensorAxis axis, AxisData &data, AccRange range);
///@brief Get accelerometer xyz axis as float.\n
///
///On Entry:
///@param[in] data - SensorData structure
- ///@param[in] accConfig - Accelerometer configuration structure
+ ///@param[in] range - Accelerometer range
///
///On Exit:
///@param[out] data - Structure holds raw and scaled data for all three axis
///
///@returns 0 on success, non 0 on failure
- int32_t getAccXYZ(SensorData &data, AccConfig accConfig);
+ int32_t getAccXYZ(SensorData &data, AccRange range);
///@brief Get sensor time.\n
@@ -463,6 +447,18 @@
///
///@returns returns 0 on success, non 0 on failure
int32_t getSensorTime(float *data);
+
+
+ ///@brief Get die temperature.\n
+ ///
+ ///On Entry:
+ ///@param[in] temp - pointer to float for temperature
+ ///
+ ///On Exit:
+ ///@param[out] temp - on success, holds the die temperature
+ ///
+ ///@returns 0 on success, non 0 on failure
+ int32_t getTemperature(float *temp);
};