First Commit as a new library
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:
- 15:dc35ccc0b08e
- Parent:
- 14:646eb94fa2eb
- Child:
- 16:12782f5d4aa4
diff -r 646eb94fa2eb -r dc35ccc0b08e bmi160.h
--- a/bmi160.h Tue Dec 20 19:32:26 2016 +0000
+++ b/bmi160.h Tue Dec 20 21:20:22 2016 +0000
@@ -69,7 +69,7 @@
{
X_AXIS = 0,
Y_AXIS,
- Z_AXIS
+ Z_AXIS
};
///Structure for axis data
@@ -79,6 +79,16 @@
float scaled; ///<Axis scaled data
};
+ ///Structure for sensor time data
+ struct SensorTime
+ {
+ uint32_t raw; ///<raw SensorTime
+ float seconds; ///<SensorTime as seconds
+ };
+
+ ///Period of internal counter
+ static const float SENSOR_TIME_LSB = 39e-6;
+
///Structure for holding sensor data
struct SensorData
{
@@ -285,12 +295,17 @@
///Accelerometer ranges
enum AccRange
{
- SENS_2G = 0, ///<Accelerometer range +-2G
- SENS_4G, ///<Accelerometer range +-4G
- SENS_8G, ///<Accelerometer range +-8G
- SENS_16G, ///<Accelerometer range +-16G
+ SENS_2G = 0x03, ///<Accelerometer range +-2G
+ SENS_4G = 0x05, ///<Accelerometer range +-4G
+ SENS_8G = 0x08, ///<Accelerometer range +-8G
+ SENS_16G = 0x0C, ///<Accelerometer range +-16G
};
+ static const float SENS_2G_LSB_PER_G = 16384.0F;
+ static const float SENS_4G_LSB_PER_G = 8192.0F;
+ static const float SENS_8G_LSB_PER_G = 4096.0F;
+ static const float SENS_16G_LSB_PER_G = 2048.0F;
+
///Accelerometer configuration data structure
struct AccConfig
{
@@ -473,19 +488,34 @@
///@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, AccRange range);
+ int32_t getAccXYZ(SensorData &data, AccRange range);
+
+
+ ///@brief Get accelerometer xyz axis and sensor time.\n
+ ///
+ ///On Entry:
+ ///@param[in] data - SensorData structure
+ ///@param[in] sensorTime - SensorTime structure for data
+ ///@param[in] range - Accelerometer range
+ ///
+ ///On Exit:
+ ///@param[out] data - Structure holds raw and scaled data for all three axis
+ ///@param[out] sensorTime - Holds sensor time on success
+ ///
+ ///@returns 0 on success, non 0 on failure
+ int32_t getAccXYZandSensorTime(SensorData &data, SensorTime &sensorTime, AccRange range);
///@brief Get sensor time.\n
///
///On Entry:
- ///@param[in] data - pointer to float for holding data
+ ///@param[in] sensorTime - SensorTime structure for data
///
///On Exit:
- ///@param[out] data - time in seconds, as float
+ ///@param[out] sensorTime - Holds sensor time on success
///
///@returns returns 0 on success, non 0 on failure
- int32_t getSensorTime(float *data);
+ int32_t getSensorTime(SensorTime &sensorTime);
///@brief Get die temperature.\n