BMI160 Initial
Dependents: MAX32630HSP3_IMU_HelloWorld MAX32630HSP3_IMU_HelloWorld MAX32630HSP3_Pitch_Charles Maxim_Squeeks
Revision 19:8e66f58bef44, committed 2018-05-04
- Comitter:
- Emre.Eken
- Date:
- Fri May 04 13:32:36 2018 +0300
- Parent:
- 18:4949e9b15b6e
- Child:
- 20:a521606048bb
- Commit message:
- Some minor changes are done to make it be compiled by IAR. It can be still compiled by GCC, mbed online, Keil compilers and it has the same functionality with the previous revision
Changed in this revision
--- a/bmi160.cpp Tue Jul 11 19:38:42 2017 +0000
+++ b/bmi160.cpp Fri May 04 13:32:36 2018 +0300
@@ -42,6 +42,20 @@
const struct BMI160::GyroConfig BMI160::DEFAULT_GYRO_CONFIG = {DPS_2000,
GYRO_BWP_2,
GYRO_ODR_8};
+
+///Period of internal counter
+static const float SENSOR_TIME_LSB = 39e-6;
+
+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;
+
+static const float SENS_2000_DPS_LSB_PER_DPS = 16.4F;
+static const float SENS_1000_DPS_LSB_PER_DPS = 32.8F;
+static const float SENS_500_DPS_LSB_PER_DPS = 65.6F;
+static const float SENS_250_DPS_LSB_PER_DPS = 131.2F;
+static const float SENS_125_DPS_LSB_PER_DPS = 262.4F;
//*****************************************************************************
--- a/bmi160.h Tue Jul 11 19:38:42 2017 +0000
+++ b/bmi160.h Fri May 04 13:32:36 2018 +0300
@@ -42,8 +42,8 @@
navigation which require highly accurate, real-time sensor data.
In full operation mode, with both the accelerometer and gyroscope enabled, the
-current consumption is typically 950 μA, enabling always-on applications in
-battery driven devices. It is available in a compact 14-pin 2.5 x 3.0 x 0.8 mm³
+current consumption is typically 950 μA, enabling always-on applications in
+battery driven devices. It is available in a compact 14-pin 2.5 x 3.0 x 0.8 mm³
LGA package."
This class is an abstract base class and can not be instaniated, use BMI160_I2C
@@ -86,9 +86,6 @@
float seconds; ///<SensorTime as seconds
};
- ///Period of internal counter
- static const float SENSOR_TIME_LSB = 39e-6;
-
///Structure for holding sensor data
struct SensorData
{
@@ -301,11 +298,6 @@
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
{
@@ -362,12 +354,6 @@
DPS_125 ///<+-125dps, 262.4LSB/dps,
};
- static const float SENS_2000_DPS_LSB_PER_DPS = 16.4F;
- static const float SENS_1000_DPS_LSB_PER_DPS = 32.8F;
- static const float SENS_500_DPS_LSB_PER_DPS = 65.6F;
- static const float SENS_250_DPS_LSB_PER_DPS = 131.2F;
- static const float SENS_125_DPS_LSB_PER_DPS = 262.4F;
-
///Gyroscope configuration data structure
struct GyroConfig
{
--- a/bmi160_i2c.cpp Tue Jul 11 19:38:42 2017 +0000
+++ b/bmi160_i2c.cpp Fri May 04 13:32:36 2018 +0300
@@ -88,11 +88,11 @@
const uint8_t *data)
{
int32_t numBytes = ((stopReg - startReg) + 1);
- char packet[numBytes + 1];
+ char packet[32];
packet[0] = static_cast<char>(startReg);
memcpy(packet + 1, data, numBytes);
- return m_i2cBus.write(m_Wadrs, packet, sizeof(packet));
+ return m_i2cBus.write(m_Wadrs, packet, (numBytes+1) * sizeof(char));
}