Merge branch 'px4dev_new_param' of https://github.com/PX4/Firmware into px4dev_new_param

This commit is contained in:
px4dev
2012-08-20 01:53:37 -07:00
6 changed files with 263 additions and 153 deletions
+9
View File
@@ -193,6 +193,15 @@ param_for_index(unsigned index)
return PARAM_INVALID;
}
int
param_get_index(param_t param)
{
if (handle_in_range(param))
return (unsigned)param;
return -1;
}
const char *
param_name(param_t param)
{
+12 -2
View File
@@ -102,6 +102,14 @@ __EXPORT unsigned param_count(void) __attribute__((const));
*/
__EXPORT param_t param_for_index(unsigned index) __attribute__((const));
/**
* Look up the index of a parameter.
*
* @param param The parameter to obtain the index for.
* @return The index, or -1 if the parameter does not exist.
*/
__EXPORT int param_get_index(param_t param) __attribute__((const));
/**
* Obtain the name of a parameter.
*
@@ -156,7 +164,7 @@ __EXPORT int param_set(param_t param, const void *val);
__EXPORT int param_export(int fd, bool only_unsaved);
/**
* Import parameters from a file, discarding any unrecognised parameters.
* Import parameters from a file, discarding any unrecognized parameters.
*
* @param fd File descriptor to import from. (Currently expected to be a file.)
* @return Zero on success, nonzero if an error occurred during import.
@@ -167,7 +175,9 @@ __EXPORT int param_import(int fd);
/**
* Apply a function to each parameter.
*
* Note that the parameter set is not locked during the traversal.
* Note that the parameter set is not locked during the traversal. It also does
* not hold an internal state, so the callback function can block or sleep between
* parameter callbacks.
*
* @param func The function to invoke for each parameter.
* @param arg Argument passed to the function.