1
0
forked from me/IronOS

Check chip ID on the BMA

This commit is contained in:
Ben V. Brown
2021-01-15 21:26:39 +11:00
parent a66ff001d8
commit ee0385e380

View File

@@ -9,7 +9,15 @@
#include <array>
bool BMA223::detect() {
return FRToSI2C::probe(BMA223_ADDRESS);
if (FRToSI2C::probe(BMA223_ADDRESS)) {
//Read chip id to ensure its not an address collision
uint8_t id = 0;
if (FRToSI2C::Mem_Read(BMA223_ADDRESS, BMA223_BGW_CHIPID, &id, 1)) {
return id == 0b11111000;
}
}
return false;
}
static const FRToSI2C::I2C_REG i2c_registers[] = { //