Skip to content

Commit a79afdf

Browse files
Laurence BankLaurence Bank
authored andcommitted
added detection of BNO055 and fixed nRF52 compat issue
1 parent 3a4429d commit a79afdf

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

examples/I2C_Detector/I2C_Detector.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const char *szNames[] = {"Unknown","SSD1306","SH1106","VL53L0X","BMP180", "BMP2
5959
"MPU-60x0", "MPU-9250", "MCP9808","LSM6DS3", "ADXL345", "ADS1115","MAX44009",
6060
"MAG3110", "CCS811", "HTS221", "LPS25H", "LSM9DS1","LM8330", "DS3231", "LIS3DH",
6161
"LIS3DSH","INA219","SHT3X","HDC1080","MPU6886","BME680", "AXP202", "AXP192", "24AA02XEXX",
62-
"DS1307", "MPU688X", "FT6236G", "FT6336G", "FT6336U", "FT6436", "BM8563"};
62+
"DS1307", "MPU688X", "FT6236G", "FT6336G", "FT6336U", "FT6436", "BM8563","BNO055"};
6363
#endif
6464

6565
BBI2C bbi2c;

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=BitBang_I2C
2-
version=2.1.3
2+
version=2.1.4
33
author=Larry Bank <[email protected]>
44
maintainer=Larry Bank <[email protected]>
55
sentence=Bit-bang the I2C protocol on any 2 GPIO pins on any system.

src/BitBang_I2C.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ void I2CInit(BBI2C *pI2C, uint32_t iClock)
556556
if (pI2C->bWire) // use Wire library
557557
{
558558
#if !defined( _LINUX_ ) && !defined( __AVR_ATtiny85__ )
559-
#if defined(TEENSYDUINO) || defined( __AVR__ ) || defined( NRF52 ) || defined ( ARDUINO_ARCH_NRF52840 ) || defined(ARDUINO_ARCH_SAM)
559+
#if defined(TEENSYDUINO) || defined( __AVR__ ) || defined( NRF52 ) || defined ( ARDUINO_ARCH_NRF52840 ) || defined(ARDUINO_ARCH_NRF52) || defined(ARDUINO_ARCH_SAM)
560560
Wire.begin();
561561
#else
562562
if (pI2C->iSDA == 0xff || pI2C->iSCL == 0xff)
@@ -808,6 +808,12 @@ int I2CDiscoverDevice(BBI2C *pI2C, uint8_t i)
808808
uint8_t j, cTemp[8];
809809
int iDevice = DEVICE_UNKNOWN;
810810

811+
if (i == 0x28 || i == 0x29) // Probably a Bosch BNO055
812+
{
813+
I2CReadRegister(pI2C, i, 0x00, cTemp, 1); // CHIP_ID register
814+
if (cTemp[0] == 0xa0)
815+
return DEVICE_BNO055;
816+
}
811817
if (i == 0x3c || i == 0x3d) // Probably an OLED display
812818
{
813819
I2CReadRegister(pI2C, i, 0x00, cTemp, 1);

src/BitBang_I2C.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ enum {
5858
DEVICE_FT6336G,
5959
DEVICE_FT6336U,
6060
DEVICE_FT6436,
61-
DEVICE_BM8563
61+
DEVICE_BM8563,
62+
DEVICE_BNO055
6263
};
6364

6465
typedef struct mybbi2c

0 commit comments

Comments
 (0)