mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 20:00:34 +08:00
Make NuttX drivers cross platform (VDev -> CDev)
This commit is contained in:
committed by
Lorenz Meier
parent
6562dd496b
commit
07619cf723
@@ -72,7 +72,7 @@
|
||||
#include "airspeedsim.h"
|
||||
|
||||
AirspeedSim::AirspeedSim(int bus, int address, unsigned conversion_interval, const char *path) :
|
||||
VDev("AIRSPEEDSIM", path),
|
||||
CDev("AIRSPEEDSIM", path),
|
||||
_reports(nullptr),
|
||||
_retries(0),
|
||||
_sensor_ok(false),
|
||||
@@ -119,8 +119,8 @@ AirspeedSim::init()
|
||||
int ret = ERROR;
|
||||
|
||||
/* init base class */
|
||||
if (VDev::init() != OK) {
|
||||
DEVICE_DEBUG("VDev init failed");
|
||||
if (CDev::init() != OK) {
|
||||
DEVICE_DEBUG("CDev init failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
# error This requires CONFIG_SCHED_WORKQUEUE.
|
||||
#endif
|
||||
|
||||
class __EXPORT AirspeedSim : public device::VDev
|
||||
class __EXPORT AirspeedSim : public device::CDev
|
||||
{
|
||||
public:
|
||||
AirspeedSim(int bus, int address, unsigned conversion_interval, const char *path);
|
||||
|
||||
@@ -44,16 +44,6 @@
|
||||
#define ADC_AIRSPEED_VOLTAGE_CHANNEL 11
|
||||
#define ADCSIM0_DEVICE_PATH "/dev/adc0"
|
||||
|
||||
/*
|
||||
* I2C busses
|
||||
*/
|
||||
#define PX4_I2C_BUS_ESC 1
|
||||
#define PX4_SIM_BUS_TEST 2
|
||||
#define PX4_I2C_BUS_EXPANSION 3
|
||||
#define PX4_I2C_BUS_LED 3
|
||||
#define PX4_NUMBER_I2C_BUSES 3
|
||||
#define PX4_I2C_OBDEV_LED 0x55
|
||||
|
||||
#define SIM_FORMATED_UUID "000000010000000200000003"
|
||||
#define PX4_CPU_UUID_BYTE_LENGTH 12
|
||||
#define PX4_CPU_UUID_WORD32_LENGTH 3
|
||||
|
||||
@@ -99,11 +99,11 @@ public:
|
||||
size_t _read_offset;
|
||||
};
|
||||
|
||||
class VCDevNode : public VDev
|
||||
class VCDevNode : public CDev
|
||||
{
|
||||
public:
|
||||
VCDevNode() :
|
||||
VDev("vcdevtest", TESTDEV),
|
||||
CDev("vcdevtest", TESTDEV),
|
||||
_is_open_for_write(false),
|
||||
_write_offset(0) {};
|
||||
|
||||
@@ -127,7 +127,7 @@ int VCDevNode::open(device::file_t *handlep)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret = VDev::open(handlep);
|
||||
int ret = CDev::open(handlep);
|
||||
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
@@ -146,7 +146,7 @@ int VCDevNode::close(device::file_t *handlep)
|
||||
{
|
||||
delete (PrivData *)handlep->priv;
|
||||
handlep->priv = nullptr;
|
||||
VDev::close(handlep);
|
||||
CDev::close(handlep);
|
||||
|
||||
// Enable a new writer of the device is re-opened for write
|
||||
if ((handlep->flags & PX4_F_WRONLY) && _is_open_for_write) {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* I2C busses
|
||||
*/
|
||||
#define PX4_I2C_BUS_ESC 1
|
||||
#define PX4_SIM_BUS_TEST 2
|
||||
#define PX4_I2C_BUS_EXPANSION 3
|
||||
#define PX4_I2C_BUS_LED 3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user