diff --git a/libraries/AP_HAL_PX4/I2CDevice.cpp b/libraries/AP_HAL_PX4/I2CDevice.cpp index 5b28ab9bd9..624aa7439b 100644 --- a/libraries/AP_HAL_PX4/I2CDevice.cpp +++ b/libraries/AP_HAL_PX4/I2CDevice.cpp @@ -53,7 +53,13 @@ uint8_t PX4_I2C::map_bus_number(uint8_t bus) const #else return 1; #endif - + case 2: + // map to expansion bus 2 +#ifdef PX4_I2C_BUS_EXPANSION1 + return PX4_I2C_BUS_EXPANSION1; +#else + return 2; +#endif } // default to bus 1 return 1; diff --git a/libraries/AP_HAL_PX4/I2CDevice.h b/libraries/AP_HAL_PX4/I2CDevice.h index 0246dd1ea9..12f0a5eb80 100644 --- a/libraries/AP_HAL_PX4/I2CDevice.h +++ b/libraries/AP_HAL_PX4/I2CDevice.h @@ -70,7 +70,7 @@ public: } private: - static const uint8_t num_buses = 2; + static const uint8_t num_buses = 3; static DeviceBus businfo[num_buses]; uint8_t _busnum;