aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-10-11 00:25:10 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-12-26 19:57:21 +0100
commit0e84f60826a5f640233a3e265da2079f89e422c0 (patch)
treea51775c3ceefef8d7477ddadf623c2936fb06a99 /src
parentda977bb39bf6157247cfd31a3da0f0f80b497bf0 (diff)
downloadpx4-firmware-0e84f60826a5f640233a3e265da2079f89e422c0.tar.gz
px4-firmware-0e84f60826a5f640233a3e265da2079f89e422c0.tar.bz2
px4-firmware-0e84f60826a5f640233a3e265da2079f89e422c0.zip
Add macro for multi topic support
Diffstat (limited to 'src')
-rw-r--r--src/modules/uORB/uORB.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/modules/uORB/uORB.h b/src/modules/uORB/uORB.h
index 82ff46ad2..beb23f61d 100644
--- a/src/modules/uORB/uORB.h
+++ b/src/modules/uORB/uORB.h
@@ -68,6 +68,33 @@ typedef const struct orb_metadata *orb_id_t;
#define ORB_ID(_name) &__orb_##_name
/**
+ * Generates a pointer to the uORB metadata structure for
+ * a given topic.
+ *
+ * The topic must have been declared previously in scope
+ * with ORB_DECLARE().
+ *
+ * @param _name The name of the topic.
+ * @param _count The class ID of the topic
+ */
+#define ORB_ID_DOUBLE(_name, _count) ((_count == CLASS_DEVICE_PRIMARY) ? &__orb_##_name##0 : &__orb_##_name##1)
+
+/**
+ * Generates a pointer to the uORB metadata structure for
+ * a given topic.
+ *
+ * The topic must have been declared previously in scope
+ * with ORB_DECLARE().
+ *
+ * @param _name The name of the topic.
+ * @param _count The class ID of the topic
+ */
+#define ORB_ID_TRIPLE(_name, _count) \
+ ((_count == CLASS_DEVICE_PRIMARY) ? &__orb_##_name##0 : \
+ ((_count == CLASS_DEVICE_SECONDARY) ? &__orb_##_name##1 : \
+ (((_count == CLASS_DEVICE_TERTIARY) ? &__orb_##_name##2 : 0))))
+
+/**
* Declare (prototype) the uORB metadata for a topic.
*
* Note that optional topics are declared weak; this allows a potential