mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 08:51:36 +08:00
I2C/SPI require device type in constructor
This commit is contained in:
@@ -46,11 +46,9 @@ LPS22HB::LPS22HB(I2CSPIBusOption bus_option, int bus, device::Device *interface)
|
||||
CDev(nullptr),
|
||||
I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id()), bus_option, bus),
|
||||
_interface(interface),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "lps22hb_read")),
|
||||
_comms_errors(perf_alloc(PC_COUNT, "lps22hb_comms_errors"))
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": read")),
|
||||
_comms_errors(perf_alloc(PC_COUNT, MODULE_NAME": comms_errors"))
|
||||
{
|
||||
// set the interface device type
|
||||
_interface->set_device_type(DRV_BARO_DEVTYPE_LPS22HB);
|
||||
}
|
||||
|
||||
LPS22HB::~LPS22HB()
|
||||
|
||||
@@ -64,7 +64,7 @@ LPS22HB_I2C_interface(int bus, int bus_frequency)
|
||||
}
|
||||
|
||||
LPS22HB_I2C::LPS22HB_I2C(int bus, int bus_frequency) :
|
||||
I2C("LPS22HB_I2C", nullptr, bus, LPS22HB_ADDRESS, bus_frequency)
|
||||
I2C(DRV_BARO_DEVTYPE_LPS22HB, MODULE_NAME, bus, LPS22HB_ADDRESS, bus_frequency)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -64,9 +64,8 @@ LPS22HB_SPI_interface(int bus, uint32_t devid, int bus_frequency, spi_mode_e spi
|
||||
}
|
||||
|
||||
LPS22HB_SPI::LPS22HB_SPI(int bus, uint32_t device, int bus_frequency, spi_mode_e spi_mode)
|
||||
: SPI("LPS22HB_SPI", nullptr, bus, device, spi_mode, bus_frequency)
|
||||
: SPI(DRV_BARO_DEVTYPE_LPS22HB, MODULE_NAME, bus, device, spi_mode, bus_frequency)
|
||||
{
|
||||
_device_id.devid_s.devtype = DRV_BARO_DEVTYPE_LPS22HB;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user