From 69c97c1565d15fe70a5e505c7ca46bfd54707323 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 19 Aug 2020 14:57:51 +1000 Subject: [PATCH] SITL: add support for multiple i2c buses --- libraries/SITL/SIM_I2C.cpp | 2 +- libraries/SITL/SIM_I2C.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/SITL/SIM_I2C.cpp b/libraries/SITL/SIM_I2C.cpp index 1e2a1f6eec..9670d368ff 100644 --- a/libraries/SITL/SIM_I2C.cpp +++ b/libraries/SITL/SIM_I2C.cpp @@ -94,7 +94,7 @@ int I2C::ioctl_rdwr(i2c_rdwr_ioctl_data *data) } } if (!handled) { - ::fprintf(stderr, "Unhandled i2c message: addr=0x%x flags=%u len=%u\n", msg.addr, msg.flags, msg.len); + ::fprintf(stderr, "Unhandled i2c message: bus=%u addr=0x%02x flags=%u len=%u\n", msg.bus, msg.addr, msg.flags, msg.len); return -1; // ?! } } diff --git a/libraries/SITL/SIM_I2C.h b/libraries/SITL/SIM_I2C.h index e85994276f..aeb9a446e8 100644 --- a/libraries/SITL/SIM_I2C.h +++ b/libraries/SITL/SIM_I2C.h @@ -40,6 +40,7 @@ public: #define I2C_M_RD 1 #define I2C_RDWR 0 struct i2c_msg { + uint8_t bus; uint8_t addr; uint8_t flags; uint8_t *buf;