mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 11:28:52 +08:00
drivers: use updated I2C SPI driver interface
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user