From a69ae3493d99250bd5a46ba1ac5f11fcf2d05069 Mon Sep 17 00:00:00 2001 From: Roman Bapst Date: Thu, 25 Sep 2014 10:24:39 +0200 Subject: [PATCH] Adapted so that can be used with ROS --- src/drivers/drv_accel.h | 64 ++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/src/drivers/drv_accel.h b/src/drivers/drv_accel.h index 1f98d966bd..49b104d380 100644 --- a/src/drivers/drv_accel.h +++ b/src/drivers/drv_accel.h @@ -42,12 +42,13 @@ #include #include - +#ifdef CONFIG_ARCH_ARM #include "drv_sensor.h" #include "drv_orb_dev.h" #define ACCEL_DEVICE_PATH "/dev/accel" +#endif /** * accel report structure. Reads from the device must be in multiples of this * structure. @@ -81,46 +82,49 @@ struct accel_scale { /* * ObjDev tag for raw accelerometer data. */ -ORB_DECLARE(sensor_accel0); -ORB_DECLARE(sensor_accel1); -ORB_DECLARE(sensor_accel2); +#ifdef CONFIG_ARCH_ARM + ORB_DECLARE(sensor_accel0); + ORB_DECLARE(sensor_accel1); + ORB_DECLARE(sensor_accel2); -/* - * ioctl() definitions - * - * Accelerometer drivers also implement the generic sensor driver - * interfaces from drv_sensor.h - */ + /* + * ioctl() definitions + * + * Accelerometer drivers also implement the generic sensor driver + * interfaces from drv_sensor.h + */ -#define _ACCELIOCBASE (0x2100) -#define _ACCELIOC(_n) (_IOC(_ACCELIOCBASE, _n)) + #define _ACCELIOCBASE (0x2100) + #define _ACCELIOC(_n) (_IOC(_ACCELIOCBASE, _n)) -/** set the accel internal sample rate to at least (arg) Hz */ -#define ACCELIOCSSAMPLERATE _ACCELIOC(0) + /** set the accel internal sample rate to at least (arg) Hz */ + #define ACCELIOCSSAMPLERATE _ACCELIOC(0) -/** return the accel internal sample rate in Hz */ -#define ACCELIOCGSAMPLERATE _ACCELIOC(1) + /** return the accel internal sample rate in Hz */ + #define ACCELIOCGSAMPLERATE _ACCELIOC(1) -/** set the accel internal lowpass filter to no lower than (arg) Hz */ -#define ACCELIOCSLOWPASS _ACCELIOC(2) + /** set the accel internal lowpass filter to no lower than (arg) Hz */ + #define ACCELIOCSLOWPASS _ACCELIOC(2) -/** return the accel internal lowpass filter in Hz */ -#define ACCELIOCGLOWPASS _ACCELIOC(3) + /** return the accel internal lowpass filter in Hz */ + #define ACCELIOCGLOWPASS _ACCELIOC(3) -/** set the accel scaling constants to the structure pointed to by (arg) */ -#define ACCELIOCSSCALE _ACCELIOC(5) + /** set the accel scaling constants to the structure pointed to by (arg) */ + #define ACCELIOCSSCALE _ACCELIOC(5) -/** get the accel scaling constants into the structure pointed to by (arg) */ -#define ACCELIOCGSCALE _ACCELIOC(6) + /** get the accel scaling constants into the structure pointed to by (arg) */ + #define ACCELIOCGSCALE _ACCELIOC(6) -/** set the accel measurement range to handle at least (arg) g */ -#define ACCELIOCSRANGE _ACCELIOC(7) + /** set the accel measurement range to handle at least (arg) g */ + #define ACCELIOCSRANGE _ACCELIOC(7) -/** get the current accel measurement range in g */ -#define ACCELIOCGRANGE _ACCELIOC(8) + /** get the current accel measurement range in g */ + #define ACCELIOCGRANGE _ACCELIOC(8) -/** get the result of a sensor self-test */ -#define ACCELIOCSELFTEST _ACCELIOC(9) + /** get the result of a sensor self-test */ + #define ACCELIOCSELFTEST _ACCELIOC(9) + +#endif #endif /* _DRV_ACCEL_H */