aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-01-26 09:51:36 +0100
committerLorenz Meier <lm@inf.ethz.ch>2015-01-29 16:33:54 +0100
commite532b81ac1f3356a3f2771d605b8d92d88d19d67 (patch)
treea689fedb466912abf55e35c831df625b30722266
parentaadbcb42a91d5158330c7e1f63103ee64f3fbd7c (diff)
downloadpx4-firmware-e532b81ac1f3356a3f2771d605b8d92d88d19d67.tar.gz
px4-firmware-e532b81ac1f3356a3f2771d605b8d92d88d19d67.tar.bz2
px4-firmware-e532b81ac1f3356a3f2771d605b8d92d88d19d67.zip
uORB: Remove last remnants of ORB_ID_DOUBLE/TRIPLE and migrate actuator outputs groups to new style interface
-rw-r--r--src/modules/uORB/objects_common.cpp5
-rw-r--r--src/modules/uORB/topics/actuator_outputs.h8
-rw-r--r--src/modules/uORB/uORB.h58
3 files changed, 32 insertions, 39 deletions
diff --git a/src/modules/uORB/objects_common.cpp b/src/modules/uORB/objects_common.cpp
index 4a41aa465..ba1ac0350 100644
--- a/src/modules/uORB/objects_common.cpp
+++ b/src/modules/uORB/objects_common.cpp
@@ -196,10 +196,7 @@ ORB_DEFINE(actuator_controls_virtual_fw, struct actuator_controls_s);
ORB_DEFINE(actuator_armed, struct actuator_armed_s);
#include "topics/actuator_outputs.h"
-ORB_DEFINE(actuator_outputs_0, struct actuator_outputs_s);
-ORB_DEFINE(actuator_outputs_1, struct actuator_outputs_s);
-ORB_DEFINE(actuator_outputs_2, struct actuator_outputs_s);
-ORB_DEFINE(actuator_outputs_3, struct actuator_outputs_s);
+ORB_DEFINE(actuator_outputs, struct actuator_outputs_s);
#include "topics/actuator_direct.h"
ORB_DEFINE(actuator_direct, struct actuator_direct_s);
diff --git a/src/modules/uORB/topics/actuator_outputs.h b/src/modules/uORB/topics/actuator_outputs.h
index 446140423..5f8f6d83e 100644
--- a/src/modules/uORB/topics/actuator_outputs.h
+++ b/src/modules/uORB/topics/actuator_outputs.h
@@ -68,12 +68,6 @@ struct actuator_outputs_s {
*/
/* actuator output sets; this list can be expanded as more drivers emerge */
-ORB_DECLARE(actuator_outputs_0);
-ORB_DECLARE(actuator_outputs_1);
-ORB_DECLARE(actuator_outputs_2);
-ORB_DECLARE(actuator_outputs_3);
-
-/* output sets with pre-defined applications */
-#define ORB_ID_VEHICLE_CONTROLS ORB_ID(actuator_outputs_0)
+ORB_DECLARE(actuator_outputs);
#endif \ No newline at end of file
diff --git a/src/modules/uORB/uORB.h b/src/modules/uORB/uORB.h
index 30cd59880..9c33c8a3e 100644
--- a/src/modules/uORB/uORB.h
+++ b/src/modules/uORB/uORB.h
@@ -87,33 +87,6 @@ enum ORB_PRIO {
#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
@@ -147,7 +120,7 @@ enum ORB_PRIO {
#define ORB_DEFINE(_name, _struct) \
const struct orb_metadata __orb_##_name = { \
#_name, \
- sizeof(_struct), \
+ sizeof(_struct) \
}; struct hack
__BEGIN_DECLS
@@ -257,6 +230,35 @@ extern int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, con
*/
extern int orb_subscribe(const struct orb_metadata *meta) __EXPORT;
+/**
+ * Subscribe to a multi-instance of a topic.
+ *
+ * The returned value is a file descriptor that can be passed to poll()
+ * in order to wait for updates to a topic, as well as topic_read,
+ * orb_check and orb_stat.
+ *
+ * Subscription will succeed even if the topic has not been advertised;
+ * in this case the topic will have a timestamp of zero, it will never
+ * signal a poll() event, checking will always return false and it cannot
+ * be copied. When the topic is subsequently advertised, poll, check,
+ * stat and copy calls will react to the initial publication that is
+ * performed as part of the advertisement.
+ *
+ * Subscription will fail if the topic is not known to the system, i.e.
+ * there is nothing in the system that has declared the topic and thus it
+ * can never be published.
+ *
+ * @param meta The uORB metadata (usually from the ORB_ID() macro)
+ * for the topic.
+ * @param instance The instance of the topic. Instance 0 matches the
+ * topic of the orb_subscribe() call, higher indices
+ * are for topics created with orb_publish_multi().
+ * @return ERROR on error, otherwise returns a handle
+ * that can be used to read and update the topic.
+ * If the topic in question is not known (due to an
+ * ORB_DEFINE_OPTIONAL with no corresponding ORB_DECLARE)
+ * this function will return -1 and set errno to ENOENT.
+ */
extern int orb_subscribe_multi(const struct orb_metadata *meta, unsigned instance) __EXPORT;
/**