mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 14:03:35 +08:00
delete drv_baro.h, drv_mag.h, drv_range_finder.h, drv_device.h and purge UAVCAN CDev usage
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
#include <cstring>
|
||||
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <drivers/drv_device.h>
|
||||
|
||||
namespace device
|
||||
{
|
||||
@@ -77,21 +76,4 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CDev::ioctl(file_t *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
PX4_DEBUG("CDev::ioctl");
|
||||
int ret = -ENOTTY;
|
||||
|
||||
switch (cmd) {
|
||||
case DEVIOCGDEVICEID:
|
||||
ret = (int)_device_id.devid;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace device
|
||||
|
||||
@@ -75,16 +75,12 @@ public:
|
||||
/**
|
||||
* Perform an ioctl operation on the device.
|
||||
*
|
||||
* The default implementation handles DEVIOCGDEVICEID, and otherwise
|
||||
* returns -ENOTTY. Subclasses should call the default implementation
|
||||
* for any command they do not handle themselves.
|
||||
*
|
||||
* @param filep Pointer to the NuttX file structure.
|
||||
* @param cmd The ioctl command value.
|
||||
* @param arg The ioctl argument value.
|
||||
* @return OK on success, or -errno otherwise.
|
||||
*/
|
||||
virtual int ioctl(file_t *filep, int cmd, unsigned long arg);
|
||||
virtual int ioctl(file_t *filep, int cmd, unsigned long arg) { return -ENOTTY; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
|
||||
#include <drivers/drv_device.h>
|
||||
#include <drivers/drv_sensor.h>
|
||||
|
||||
#define DEVICE_LOG(FMT, ...) PX4_LOG_NAMED(_name, FMT, ##__VA_ARGS__)
|
||||
#define DEVICE_DEBUG(FMT, ...) PX4_LOG_NAMED_COND(_name, _debug_enabled, FMT, ##__VA_ARGS__)
|
||||
@@ -138,15 +138,7 @@ public:
|
||||
* @param arg An argument to the operation.
|
||||
* @return Negative errno on error, OK or positive value on success.
|
||||
*/
|
||||
virtual int ioctl(unsigned operation, unsigned &arg)
|
||||
{
|
||||
switch (operation) {
|
||||
case DEVIOCGDEVICEID:
|
||||
return (int)_device_id.devid;
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
virtual int ioctl(unsigned operation, unsigned &arg) { return -ENODEV; }
|
||||
|
||||
/** Device bus types for DEVID */
|
||||
enum DeviceBusType {
|
||||
@@ -182,7 +174,8 @@ public:
|
||||
*
|
||||
* @return The bus type
|
||||
*/
|
||||
DeviceBusType get_device_bus_type() const { return _device_id.devid_s.bus_type; }
|
||||
DeviceBusType get_device_bus_type() const { return _device_id.devid_s.bus_type; }
|
||||
void set_device_bus_type(DeviceBusType bus_type) { _device_id.devid_s.bus_type = bus_type; }
|
||||
|
||||
static const char *get_device_bus_string(DeviceBusType bus)
|
||||
{
|
||||
@@ -211,6 +204,7 @@ public:
|
||||
* @return The bus ID
|
||||
*/
|
||||
uint8_t get_device_bus() const { return _device_id.devid_s.bus; }
|
||||
void set_device_bus(uint8_t bus) { _device_id.devid_s.bus = bus; }
|
||||
|
||||
/**
|
||||
* Return the bus address of the device.
|
||||
|
||||
Reference in New Issue
Block a user