From 9ee007f9246734074078dfad318bb24cb8d568e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Wed, 19 Apr 2017 13:13:39 -0700 Subject: [PATCH] AP_HAL_PX4: Map PX4_I2C_BUS_EXPANSION1 --- libraries/AP_HAL_PX4/I2CDevice.cpp | 8 +++++++- libraries/AP_HAL_PX4/I2CDevice.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) 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;