drivers: use updated I2C SPI driver interface

This commit is contained in:
Beat Küng
2021-07-08 12:59:35 -04:00
committed by Daniel Agar
parent c5aef9d512
commit e644036325
218 changed files with 812 additions and 2001 deletions
+11 -5
View File
@@ -33,10 +33,10 @@
#include "SRF02.hpp"
SRF02::SRF02(I2CSPIBusOption bus_option, const int bus, const uint8_t rotation, int bus_frequency, int address) :
I2C(DRV_DIST_DEVTYPE_SRF02, MODULE_NAME, bus, address, bus_frequency),
I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(get_device_id()), bus_option, bus),
_px4_rangefinder(get_device_id(), rotation)
SRF02::SRF02(const I2CSPIDriverConfig &config) :
I2C(config),
I2CSPIDriver(config),
_px4_rangefinder(get_device_id(), config.rotation)
{
_px4_rangefinder.set_device_type(DRV_DIST_DEVTYPE_SRF02);
_px4_rangefinder.set_rangefinder_type(distance_sensor_s::MAV_DISTANCE_SENSOR_ULTRASOUND);
@@ -69,7 +69,13 @@ int SRF02::init()
// XXX we should find out why we need to wait 200 ms here
px4_usleep(200000);
return measure();
int ret = measure();
if (ret == PX4_OK) {
start();
}
return ret;
}
int SRF02::collect()