From eec3a2ab315c3c731686065ea64eef7f580bbb84 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Sep 2018 13:48:33 +1000 Subject: [PATCH] AP_HAL: added FOREACH_I2C_MASK() macro --- libraries/AP_HAL/I2CDevice.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/AP_HAL/I2CDevice.h b/libraries/AP_HAL/I2CDevice.h index 55a58bff39..841e5575c1 100644 --- a/libraries/AP_HAL/I2CDevice.h +++ b/libraries/AP_HAL/I2CDevice.h @@ -109,8 +109,9 @@ public: /* convenient macros for iterating over I2C bus numbers */ -#define FOREACH_I2C_EXTERNAL(i) for (uint32_t _bmask=hal.i2c_mgr->get_bus_mask_external(), i=0; i<32; i++) if ((1U<get_bus_mask_internal(), i=0; i<32; i++) if ((1U<get_bus_mask(), i=0; i<32; i++) if ((1U<get_bus_mask_external()) +#define FOREACH_I2C_INTERNAL(i) FOREACH_I2C_MASK(i,hal.i2c_mgr->get_bus_mask_internal()) +#define FOREACH_I2C(i) FOREACH_I2C_MASK(i,hal.i2c_mgr->get_bus_mask()) + }