mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 16:53:34 +08:00
Make NuttX drivers cross platform (VDev -> CDev)
This commit is contained in:
committed by
Lorenz Meier
parent
6562dd496b
commit
07619cf723
+1
-19
@@ -56,11 +56,7 @@ extern void led_off(int led);
|
||||
extern void led_toggle(int led);
|
||||
__END_DECLS
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
class LED : device::CDev
|
||||
#else
|
||||
class LED : device::VDev
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
LED();
|
||||
@@ -70,12 +66,7 @@ public:
|
||||
virtual int ioctl(device::file_t *filp, int cmd, unsigned long arg);
|
||||
};
|
||||
|
||||
LED::LED() :
|
||||
#ifdef __PX4_NUTTX
|
||||
CDev("led", LED0_DEVICE_PATH)
|
||||
#else
|
||||
VDev("led", LED0_DEVICE_PATH)
|
||||
#endif
|
||||
LED::LED() : CDev("led", LED0_DEVICE_PATH)
|
||||
{
|
||||
// force immediate init/device registration
|
||||
init();
|
||||
@@ -89,11 +80,7 @@ int
|
||||
LED::init()
|
||||
{
|
||||
DEVICE_DEBUG("LED::init");
|
||||
#ifdef __PX4_NUTTX
|
||||
CDev::init();
|
||||
#else
|
||||
VDev::init();
|
||||
#endif
|
||||
led_init();
|
||||
|
||||
return 0;
|
||||
@@ -117,13 +104,8 @@ LED::ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
||||
led_toggle(arg);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
#ifdef __PX4_NUTTX
|
||||
result = CDev::ioctl(filp, cmd, arg);
|
||||
#else
|
||||
result = VDev::ioctl(filp, cmd, arg);
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user