aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-12-17 15:49:03 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-12-17 15:49:03 +0100
commit7ad3b0335336d65736f707486b2b714d0fa91c2a (patch)
treeb2eeddcf266aadc5f55e7a317b614338246c1790
parent2d0f11783c1394b44d31d6bd6d07612c164dbe90 (diff)
downloadpx4-firmware-7ad3b0335336d65736f707486b2b714d0fa91c2a.tar.gz
px4-firmware-7ad3b0335336d65736f707486b2b714d0fa91c2a.tar.bz2
px4-firmware-7ad3b0335336d65736f707486b2b714d0fa91c2a.zip
multi platform interface: macro to get param by name
-rw-r--r--src/platforms/px4_defines.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h
index c76548381..188149008 100644
--- a/src/platforms/px4_defines.h
+++ b/src/platforms/px4_defines.h
@@ -93,9 +93,12 @@ static inline px4_param_t PX4_ROS_PARAM_SET(const char *name, float value)
/* Initialize a param, in case of ROS the parameter is sent to the parameter server here */
#define PX4_PARAM_INIT(_name) PX4_ROS_PARAM_SET(#_name, PX4_PARAM_DEFAULT_VALUE_NAME(_name))
-/* Get value of parameter */
+/* Get value of parameter by handle */
#define PX4_PARAM_GET(_handle, _destpt) ros::param::get(_handle, *_destpt)
+/* Get value of parameter by name, which is equal to the handle for ros */
+#define PX4_PARAM_GET_NAME(_name, _destpt) PX4_PARAM_GET(_name, _destpt)
+
#define OK 0
#define ERROR -1
@@ -163,9 +166,12 @@ typedef param_t px4_param_t;
/* Initialize a param, get param handle */
#define PX4_PARAM_INIT(_name) param_find(#_name)
-/* Get value of parameter */
+/* Get value of parameter by handle */
#define PX4_PARAM_GET(_handle, _destpt) param_get(_handle, _destpt)
+/* Get value of parameter by name */
+#define PX4_PARAM_GET_NAME(_name, _destpt) param_get(PX4_PARAM_INIT(_name), _destpt)
+
/* XXX this is a hack to resolve conflicts with NuttX headers */
#define isspace(c) \
((c) == ' ' || (c) == '\t' || (c) == '\n' || \