forked from Archive/PX4-Autopilot
Add macro for multi topic support
This commit is contained in:
parent
da977bb39b
commit
0e84f60826
|
@ -67,6 +67,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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue