mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
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:
parent
f8569ac39e
commit
2b213b78ab
28
libraries/AP_Param_Helper/AP_Param_Helper.cpp
Normal file
28
libraries/AP_Param_Helper/AP_Param_Helper.cpp
Normal 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
|
29
libraries/AP_Param_Helper/AP_Param_Helper.h
Normal file
29
libraries/AP_Param_Helper/AP_Param_Helper.h
Normal 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
|
Loading…
Reference in New Issue
Block a user