|
|
|
@ -392,6 +392,19 @@ bool BusInstanceIterator::external() const
@@ -392,6 +392,19 @@ bool BusInstanceIterator::external() const
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int BusInstanceIterator::externalBusIndex() const |
|
|
|
|
{ |
|
|
|
|
if (busType() == BOARD_INVALID_BUS) { |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
} else if (busType() == BOARD_SPI_BUS) { |
|
|
|
|
return _spi_bus_iterator.externalBusIndex(); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
return _i2c_bus_iterator.externalBusIndex(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
I2CBusIterator::FilterType BusInstanceIterator::i2cFilter(I2CSPIBusOption bus_option) |
|
|
|
|
{ |
|
|
|
|
switch (bus_option) { |
|
|
|
@ -486,14 +499,28 @@ int I2CSPIDriverBase::module_start(const BusCLIArguments &cli, BusInstanceIterat
@@ -486,14 +499,28 @@ int I2CSPIDriverBase::module_start(const BusCLIArguments &cli, BusInstanceIterat
|
|
|
|
|
// print some info that we are running
|
|
|
|
|
switch (iterator.busType()) { |
|
|
|
|
case BOARD_I2C_BUS: |
|
|
|
|
PX4_INFO_RAW("%s #%i on I2C bus %d%s\n", |
|
|
|
|
instance->ItemName(), runtime_instance, iterator.bus(), iterator.external() ? " (external)" : ""); |
|
|
|
|
PX4_INFO_RAW("%s #%i on I2C bus %d", instance->ItemName(), runtime_instance, iterator.bus()); |
|
|
|
|
|
|
|
|
|
if (iterator.external()) { |
|
|
|
|
PX4_INFO_RAW(" (external, equal to '-b %i')\n", iterator.externalBusIndex()); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
PX4_INFO_RAW("\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case BOARD_SPI_BUS: |
|
|
|
|
PX4_INFO_RAW("%s #%i on SPI bus %d (devid=0x%x)%s\n", |
|
|
|
|
instance->ItemName(), runtime_instance, iterator.bus(), PX4_SPI_DEV_ID(iterator.devid()), |
|
|
|
|
iterator.external() ? " (external)" : ""); |
|
|
|
|
PX4_INFO_RAW("%s #%i on SPI bus %d (devid=0x%x)", |
|
|
|
|
instance->ItemName(), runtime_instance, iterator.bus(), PX4_SPI_DEV_ID(iterator.devid())); |
|
|
|
|
|
|
|
|
|
if (iterator.external()) { |
|
|
|
|
PX4_INFO_RAW(" (external, equal to '-b %i')\n", iterator.externalBusIndex()); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
PX4_INFO_RAW("\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case BOARD_INVALID_BUS: |
|
|
|
|