Skip to content

Commit 8f65ef7

Browse files
Laurence BankLaurence Bank
authored andcommitted
Changes to support UNO R4
1 parent c0774c0 commit 8f65ef7

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/BitBang_I2C.cpp

Lines changed: 15 additions & 10 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", "BMI160"};
68+
"LIS3DSH","INA219","SHT3X","HDC1080","MPU6886","BME680", "AXP202", "AXP192", "24AAXXXE64", "DS1307", "MPU688X", "FT6236G", "FT6336G", "FT6336U", "FT6436", "BM8563", "BNO055", "AHT20","TMF882X","SCD4X", "ST25DV", "LTR390", "BMP388"};
6969

7070
#if defined ( __AVR__ ) && !defined( ARDUINO_ARCH_MEGAAVR )
7171
volatile uint8_t *iDDR_SCL, *iPort_SCL_Out;
@@ -588,14 +588,27 @@ void I2CInit(BBI2C *pI2C, uint32_t iClock)
588588
// Mbed Cortex-M MCUs can set I2C on custom pins
589589
if (pI2C->iSDA != 0xff) {
590590
pWire = new MbedI2C((int)pI2C->iSDA, (int)pI2C->iSCL);
591+
} else {
592+
pWire = &Wire;
591593
}
592594
#endif
593595
pWire->begin();
594596
#else
595597
if (pI2C->iSDA == 0xff || pI2C->iSCL == 0xff) {
596598
pWire->begin();
597599
} else {
600+
#ifdef ARDUINO_RASPBERRY_PI_PICO
601+
pWire->setSDA((pin_size_t)pI2C->iSDA);
602+
pWire->setSCL((pin_size_t)pI2C->iSCL);
603+
pWire->begin();
604+
#else
605+
#ifdef ARDUINO_ARCH_RENESAS
606+
pWire = new TwoWire((int)pI2C->iSDA, (int)pI2C->iSCL);
607+
pWire->begin();
608+
#else
598609
pWire->begin((int)pI2C->iSDA, (int)pI2C->iSCL);
610+
#endif
611+
#endif
599612
}
600613
#endif
601614
pWire->setClock(iClock);
@@ -1097,15 +1110,7 @@ int iDevice = DEVICE_UNKNOWN;
10971110
*pCapabilities = DEVICE_CAP_TEMPERATURE;
10981111
return DEVICE_MCP9808;
10991112
}
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-
}
1113+
11091114
// Check for SCD4x CO2 sensors
11101115
if (i == 0x62) {
11111116
// DEBUG - for now, assume it's the SCD4x

src/BitBang_I2C.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ enum {
7272
DEVICE_ST25DV,
7373
DEVICE_LTR390,
7474
DEVICE_BMP388,
75-
DEVICE_BMI160,
7675
DEVICE_COUNT
7776
};
7877

0 commit comments

Comments
 (0)