param: refactor BlockParam classes

- make the selected parameter a template argument. This
  enables type-checking at compile-time.
- move things to src/platforms.
  This provides consistent includes with ModuleBase
- add ModuleParams base class (replaces Block & SuperBlock)
- drop the Block* prefix from the class names
This commit is contained in:
Beat Küng
2018-01-31 10:26:48 +01:00
parent 0e4034d01e
commit fca99cf775
10 changed files with 612 additions and 2 deletions
+5
View File
@@ -824,6 +824,11 @@ param_used(param_t param)
(1 << param_index % bits_per_allocation_unit);
}
void param_set_used(param_t param)
{
param_set_used_internal(param);
}
void param_set_used_internal(param_t param)
{
int param_index = param_get_index(param);
+9
View File
@@ -252,6 +252,14 @@ __EXPORT int param_get(param_t param, void *val);
*/
__EXPORT int param_set(param_t param, const void *val);
/**
* Mark a parameter as used. Only marked parameters will be sent to a GCS.
* A call to param_find() will mark a param as used as well.
*
* @param param A handle returned by param_find or passed by param_foreach.
*/
__EXPORT void param_set_used(param_t param);
/**
* Set the value of a parameter, but do not notify the system about the change.
*
@@ -488,6 +496,7 @@ static inline int param_get_cplusplus(param_t param, int32_t *val)
#define param_get(param, val) param_get_cplusplus(param, val)
#endif /* __cplusplus */
#endif
@@ -805,6 +805,11 @@ param_used(param_t param)
(1 << param_index % bits_per_allocation_unit);
}
void param_set_used(param_t param)
{
param_set_used_internal(param);
}
void param_set_used_internal(param_t param)
{
int param_index = param_get_index(param);
@@ -13,7 +13,7 @@ namespace px4 { {# wrap the enum in a namespace, otherwise we get shadowing erro
/// Enum with all parameters
enum class params {
{# enums are guaranteed to start with 0 (if the value for the first is not
specified), and then incremented by 1 #}
specified), and then incremented by 1 (the implementation depends on that!) #}
{%- for param in params %}
{{ param.attrib["name"] }},
{%- endfor %}