i2c_spi_buses: add support for multiple instances of the same device on a bus

This also simplifies the API a bit, since we anyway have to change the
drivers to pass additional information (the bus device index).

The orientation flag is merged with the rotation.
This commit is contained in:
Beat Küng
2021-07-08 12:59:35 -04:00
committed by Daniel Agar
parent e4983ab88c
commit c5aef9d512
19 changed files with 252 additions and 60 deletions
+7
View File
@@ -44,6 +44,8 @@
#include <dev_fs_lib_i2c.h>
#include <px4_platform_common/i2c_spi_buses.h>
namespace device
{
@@ -58,6 +60,11 @@ I2C::I2C(uint8_t device_type, const char *name, const int bus, const uint16_t ad
_device_id.devid_s.address = address;
}
I2C::I2C(const I2CSPIDriverConfig &config)
: I2C(config.devid_driver_index, config.module_name, config.bus, config.i2c_address, config.bus_frequency)
{
}
I2C::~I2C()
{
if (_fd >= 0) {