diff --git a/src/drivers/magnetometer/isentek/ist8310/IST8310.cpp b/src/drivers/magnetometer/isentek/ist8310/IST8310.cpp index 364fbdf04c..4a5cf6c536 100644 --- a/src/drivers/magnetometer/isentek/ist8310/IST8310.cpp +++ b/src/drivers/magnetometer/isentek/ist8310/IST8310.cpp @@ -40,9 +40,9 @@ static constexpr int16_t combine(uint8_t msb, uint8_t lsb) return (msb << 8u) | lsb; } -IST8310::IST8310(I2CSPIBusOption bus_option, int bus, int bus_frequency, enum Rotation rotation) : - I2C(DRV_MAG_DEVTYPE_IST8310, MODULE_NAME, bus, I2C_ADDRESS_DEFAULT, bus_frequency), - I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(get_device_id()), bus_option, bus), +IST8310::IST8310(I2CSPIBusOption bus_option, int bus, uint8_t addr, int bus_frequency, enum Rotation rotation) : + I2C(DRV_MAG_DEVTYPE_IST8310, MODULE_NAME, bus, addr, bus_frequency), + I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(get_device_id()), bus_option, bus, addr), _px4_mag(get_device_id(), rotation) { _px4_mag.set_external(external()); diff --git a/src/drivers/magnetometer/isentek/ist8310/IST8310.hpp b/src/drivers/magnetometer/isentek/ist8310/IST8310.hpp index 945ea9d0de..5d85e08d17 100644 --- a/src/drivers/magnetometer/isentek/ist8310/IST8310.hpp +++ b/src/drivers/magnetometer/isentek/ist8310/IST8310.hpp @@ -53,7 +53,7 @@ using namespace iSentek_IST8310; class IST8310 : public device::I2C, public I2CSPIDriver { public: - IST8310(I2CSPIBusOption bus_option, int bus, int bus_frequency, enum Rotation rotation = ROTATION_NONE); + IST8310(I2CSPIBusOption bus_option, int bus, uint8_t addr, int bus_frequency, enum Rotation rotation = ROTATION_NONE); ~IST8310() override; static I2CSPIDriverBase *instantiate(const BusCLIArguments &cli, const BusInstanceIterator &iterator, diff --git a/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp b/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp index 8e75ce233f..1f3beb9e42 100644 --- a/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp +++ b/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp @@ -39,7 +39,8 @@ I2CSPIDriverBase *IST8310::instantiate(const BusCLIArguments &cli, const BusInstanceIterator &iterator, int runtime_instance) { - IST8310 *instance = new IST8310(iterator.configuredBusOption(), iterator.bus(), cli.bus_frequency, cli.rotation); + IST8310 *instance = new IST8310(iterator.configuredBusOption(), iterator.bus(), cli.i2c_address, cli.bus_frequency, + cli.rotation); if (!instance) { PX4_ERR("alloc failed"); @@ -61,6 +62,7 @@ void IST8310::print_usage() PRINT_MODULE_USAGE_SUBCATEGORY("magnetometer"); PRINT_MODULE_USAGE_COMMAND("start"); PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(true, false); + PRINT_MODULE_USAGE_PARAMS_I2C_ADDRESS(0x0E); PRINT_MODULE_USAGE_PARAM_INT('R', 0, 0, 35, "Rotation", true); PRINT_MODULE_USAGE_DEFAULT_COMMANDS(); } @@ -70,6 +72,7 @@ extern "C" int ist8310_main(int argc, char *argv[]) int ch; using ThisDriver = IST8310; BusCLIArguments cli{true, false}; + cli.i2c_address = I2C_ADDRESS_DEFAULT; cli.default_i2c_frequency = I2C_SPEED; while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {