mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-05 00:41:36 +08:00
Board drivers: Move to 0-based index
This commit is contained in:
@@ -177,7 +177,7 @@ private:
|
|||||||
extern "C" __EXPORT int px4flow_main(int argc, char *argv[]);
|
extern "C" __EXPORT int px4flow_main(int argc, char *argv[]);
|
||||||
|
|
||||||
PX4FLOW::PX4FLOW(int bus, int address, enum Rotation rotation) :
|
PX4FLOW::PX4FLOW(int bus, int address, enum Rotation rotation) :
|
||||||
I2C("PX4FLOW", PX4FLOW_DEVICE_PATH, bus, address, PX4FLOW_I2C_MAX_BUS_SPEED), /* 100-400 KHz */
|
I2C("PX4FLOW", PX4FLOW0_DEVICE_PATH, bus, address, PX4FLOW_I2C_MAX_BUS_SPEED), /* 100-400 KHz */
|
||||||
_reports(nullptr),
|
_reports(nullptr),
|
||||||
_sensor_ok(false),
|
_sensor_ok(false),
|
||||||
_measure_ticks(0),
|
_measure_ticks(0),
|
||||||
@@ -655,7 +655,7 @@ start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set the poll rate to default, starts automatic data collection */
|
/* set the poll rate to default, starts automatic data collection */
|
||||||
fd = open(PX4FLOW_DEVICE_PATH, O_RDONLY);
|
fd = open(PX4FLOW0_DEVICE_PATH, O_RDONLY);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -706,10 +706,10 @@ test()
|
|||||||
ssize_t sz;
|
ssize_t sz;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
int fd = open(PX4FLOW_DEVICE_PATH, O_RDONLY);
|
int fd = open(PX4FLOW0_DEVICE_PATH, O_RDONLY);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
err(1, "%s open failed (try 'px4flow start' if the driver is not running", PX4FLOW_DEVICE_PATH);
|
err(1, "%s open failed (try 'px4flow start' if the driver is not running", PX4FLOW0_DEVICE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -782,7 +782,7 @@ test()
|
|||||||
void
|
void
|
||||||
reset()
|
reset()
|
||||||
{
|
{
|
||||||
int fd = open(PX4FLOW_DEVICE_PATH, O_RDONLY);
|
int fd = open(PX4FLOW0_DEVICE_PATH, O_RDONLY);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
err(1, "failed ");
|
err(1, "failed ");
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ PX4FMU::~PX4FMU()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* clean up the alternate device node */
|
/* clean up the alternate device node */
|
||||||
unregister_class_devname(PWM_OUTPUT_DEVICE_PATH, _class_instance);
|
unregister_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH, _class_instance);
|
||||||
|
|
||||||
g_fmu = nullptr;
|
g_fmu = nullptr;
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ PX4FMU::init()
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* try to claim the generic PWM output device node as well - it's OK if we fail at this */
|
/* try to claim the generic PWM output device node as well - it's OK if we fail at this */
|
||||||
_class_instance = register_class_devname(PWM_OUTPUT_DEVICE_PATH);
|
_class_instance = register_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH);
|
||||||
|
|
||||||
if (_class_instance == CLASS_DEVICE_PRIMARY) {
|
if (_class_instance == CLASS_DEVICE_PRIMARY) {
|
||||||
log("default PWM output device");
|
log("default PWM output device");
|
||||||
|
|||||||
@@ -830,7 +830,7 @@ PX4IO::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* try to claim the generic PWM output device node as well - it's OK if we fail at this */
|
/* try to claim the generic PWM output device node as well - it's OK if we fail at this */
|
||||||
ret = register_driver(PWM_OUTPUT_DEVICE_PATH, &fops, 0666, (void *)this);
|
ret = register_driver(PWM_OUTPUT0_DEVICE_PATH, &fops, 0666, (void *)this);
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
log("default PWM output device");
|
log("default PWM output device");
|
||||||
@@ -1080,7 +1080,7 @@ out:
|
|||||||
|
|
||||||
/* clean up the alternate device node */
|
/* clean up the alternate device node */
|
||||||
if (_primary_pwm_device)
|
if (_primary_pwm_device)
|
||||||
unregister_driver(PWM_OUTPUT_DEVICE_PATH);
|
unregister_driver(PWM_OUTPUT0_DEVICE_PATH);
|
||||||
|
|
||||||
/* tell the dtor that we are exiting */
|
/* tell the dtor that we are exiting */
|
||||||
_task = -1;
|
_task = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user