Make NuttX drivers cross platform (VDev -> CDev)

This commit is contained in:
Daniel Agar
2017-08-31 09:27:36 +02:00
committed by Lorenz Meier
parent 6562dd496b
commit 07619cf723
29 changed files with 216 additions and 306 deletions
+1 -19
View File
@@ -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;