mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 17:23:34 +08:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user