Skip to content

Commit c0774c0

Browse files
Laurence BankLaurence Bank
authored andcommitted
Added support for BMI160 IMU
1 parent 3a1bfce commit c0774c0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/BitBang_I2C.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TwoWire *pWire = &Wire;
6565
static const char *szDeviceNames[] = {"Unknown","SSD1306","SH1106","VL53L0X","BMP180", "BMP280","BME280",
6666
"MPU-60x0", "MPU-9250", "MCP9808","LSM6DS3", "ADXL345", "ADS1115","MAX44009",
6767
"MAG3110", "CCS811", "HTS221", "LPS25H", "LSM9DS1","LM8330", "DS3231", "LIS3DH",
68-
"LIS3DSH","INA219","SHT3X","HDC1080","MPU6886","BME680", "AXP202", "AXP192", "24AAXXXE64", "DS1307", "MPU688X", "FT6236G", "FT6336G", "FT6336U", "FT6436", "BM8563", "BNO055", "AHT20","TMF882X","SCD4X", "ST25DV", "LTR390", "BMP388"};
68+
"LIS3DSH","INA219","SHT3X","HDC1080","MPU6886","BME680", "AXP202", "AXP192", "24AAXXXE64", "DS1307", "MPU688X", "FT6236G", "FT6336G", "FT6336U", "FT6436", "BM8563", "BNO055", "AHT20","TMF882X","SCD4X", "ST25DV", "LTR390", "BMP388", "BMI160"};
6969

7070
#if defined ( __AVR__ ) && !defined( ARDUINO_ARCH_MEGAAVR )
7171
volatile uint8_t *iDDR_SCL, *iPort_SCL_Out;
@@ -1097,7 +1097,15 @@ int iDevice = DEVICE_UNKNOWN;
10971097
*pCapabilities = DEVICE_CAP_TEMPERATURE;
10981098
return DEVICE_MCP9808;
10991099
}
1100-
1100+
1101+
// Check for Bosch BMI160 IMU
1102+
if (i == 0x68 || i == 0x69) {
1103+
I2CReadRegister(pI2C, i, 0x00, cTemp, 1); // CHIP_ID
1104+
if (cTemp[0] == 0xD1) { // BMI160
1105+
*pCapabilities = DEVICE_CAP_TEMPERATURE | DEVICE_CAP_ACCELEROMETER | DEVICE_CAP_GYROSCOPE;
1106+
return DEVICE_BMI160;
1107+
}
1108+
}
11011109
// Check for SCD4x CO2 sensors
11021110
if (i == 0x62) {
11031111
// DEBUG - for now, assume it's the SCD4x

src/BitBang_I2C.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ enum {
7272
DEVICE_ST25DV,
7373
DEVICE_LTR390,
7474
DEVICE_BMP388,
75+
DEVICE_BMI160,
7576
DEVICE_COUNT
7677
};
7778

0 commit comments

Comments
 (0)