mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
i2c_spi_buses:Support devices that may change address
This commit is contained in:
parent
84066f574d
commit
f70381dfdd
@ -642,7 +642,7 @@ void I2CSPIDriverBase::print_status()
|
||||
bool is_i2c_bus = _bus_option == I2CSPIBusOption::I2CExternal || _bus_option == I2CSPIBusOption::I2CInternal;
|
||||
|
||||
if (is_i2c_bus) {
|
||||
PX4_INFO("Running on I2C Bus %i, Address 0x%02X", _bus, _i2c_address);
|
||||
PX4_INFO("Running on I2C Bus %i, Address 0x%02X", _bus, get_i2c_address());
|
||||
|
||||
} else {
|
||||
PX4_INFO("Running on SPI Bus %i", _bus);
|
||||
|
||||
@ -62,11 +62,13 @@ class I2CSPIInstance : public ListNode<I2CSPIInstance *>
|
||||
{
|
||||
public:
|
||||
virtual ~I2CSPIInstance() = default;
|
||||
virtual int8_t get_i2c_address() {return _i2c_address;}
|
||||
|
||||
private:
|
||||
I2CSPIInstance(const char *module_name, I2CSPIBusOption bus_option, int bus, uint8_t i2c_address, uint16_t type)
|
||||
: _module_name(module_name), _bus_option(bus_option), _bus(bus), _type(type), _i2c_address(i2c_address) {}
|
||||
|
||||
|
||||
friend class BusInstanceIterator;
|
||||
friend class I2CSPIDriverBase;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user