32 #ifndef ROSFLIGHT_FIRMWARE_PARAM_H 33 #define ROSFLIGHT_FIRMWARE_PARAM_H 39 #ifndef GIT_VERSION_HASH 40 #define GIT_VERSION_HASH 0x00 41 #pragma message "GIT_VERSION_HASH Undefined, setting to 0x00!" 44 #ifndef GIT_VERSION_STRING 45 #define GIT_VERSION_STRING "empty" 270 void add_callback(std::function<
void(
int)> callback, uint16_t param_id);
338 return params.
names[id];
351 return params.
types[id];
390 #endif // ROSFLIGHT_FIRMWARE_PARAM_H
char names[PARAMS_COUNT][PARAMS_NAME_LENGTH]
uint16_t lookup_param_id(const char name[PARAMS_NAME_LENGTH])
Gets the id of a parameter from its name.
param_type_t types[PARAMS_COUNT]
void set_defaults(void)
Set all parameters to default values.
void change_callback(uint16_t id)
Callback for executing actions that need to be taken when a parameter value changes.
bool read(void)
Read parameter values from non-volatile memory.
void init_param_int(uint16_t id, const char name[PARAMS_NAME_LENGTH], int32_t value)
bool set_param_float(uint16_t id, float value)
Sets the value of a floating point parameter by ID and calls the parameter callback.
float get_param_float(uint16_t id) const
Get the value of a floating point parameter by id.
static constexpr uint8_t PARAMS_NAME_LENGTH
param_type_t get_param_type(uint16_t id) const
Get the type of a parameter.
void add_callback(std::function< void(int)> callback, uint16_t param_id)
const char * get_param_name(uint16_t id) const
Get the name of a parameter.
int get_param_int(uint16_t id) const
Get the value of an integer parameter by id.
bool set_param_by_name_int(const char name[PARAMS_NAME_LENGTH], int32_t value)
Sets the value of a parameter by name and calls the parameter change callback.
void init_param_float(uint16_t id, const char name[PARAMS_NAME_LENGTH], float value)
void init()
Initialize parameter values.
bool set_param_by_name_float(const char name[PARAMS_NAME_LENGTH], float value)
Sets the value of a floating point parameter by name and calls the parameter change callback...
uint8_t compute_checksum(void)
bool write(void)
Write current parameter values to non-volatile memory.
bool set_param_int(uint16_t id, int32_t value)
Sets the value of a parameter by ID and calls the parameter change callback.
std::function< void(int)> callbacks[PARAMS_COUNT]
param_value_t values[PARAMS_COUNT]