AP_Param_Helper: param table support for HAL

this allows a HAL to have its own parameter table with parameter names
generated by the build system
This commit is contained in:
night-ghost 2018-02-03 07:35:19 +11:00 committed by Andrew Tridgell
parent f8569ac39e
commit 2b213b78ab
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#include "AP_Param_Helper.h"
#include <AP_HAL/AP_HAL.h>
#if defined(HAL_NEEDS_PARAM_HELPER)
const AP_Param::GroupInfo AP_Param_Helper::var_info[] = {
// only if board defines parameters
#ifdef BOARD_HAL_VARINFO
BOARD_HAL_VARINFO,
#endif
AP_GROUPEND
};
extern const AP_HAL::HAL& hal;
AP_Param_Helper::AP_Param_Helper(bool f){
f=!f;
hal_param_helper=this;
AP_Param::setup_object_defaults(this, var_info); // setup all params
}
AP_Param_Helper * hal_param_helper;
#endif

View File

@ -0,0 +1,29 @@
/*
a helper class to give ability to HAL to have own parameters
*/
#pragma once
#include <AP_HAL/AP_HAL.h>
#if defined(HAL_NEEDS_PARAM_HELPER)
#include <AP_Param/AP_Param.h>
class AP_Param_Helper
{
public:
AP_Param_Helper(bool f);
static const AP_Param::GroupInfo var_info[];
// only if defined
#ifdef BOARD_HAL_PARAMS
BOARD_HAL_PARAMS
#endif
};
extern AP_Param_Helper * hal_param_helper;
#endif