Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
rosflight_firmware::Params Class Reference

#include <param.h>

Classes

union  param_value_t
 
struct  params_t
 

Public Member Functions

void change_callback (uint16_t id)
 Callback for executing actions that need to be taken when a parameter value changes. More...
 
float get_param_float (uint16_t id) const
 Get the value of a floating point parameter by id. More...
 
int get_param_int (uint16_t id) const
 Get the value of an integer parameter by id. More...
 
const char * get_param_name (uint16_t id) const
 Get the name of a parameter. More...
 
param_type_t get_param_type (uint16_t id) const
 Get the type of a parameter. More...
 
void init ()
 Initialize parameter values. More...
 
uint16_t lookup_param_id (const char name[PARAMS_NAME_LENGTH])
 Gets the id of a parameter from its name. More...
 
 Params (ROSflight &_rf)
 
bool read (void)
 Read parameter values from non-volatile memory. More...
 
void set_defaults (void)
 Set all parameters to default values. More...
 
void set_listeners (ParamListenerInterface *const listeners[], size_t num_listeners)
 Specify listeners for parameter changes. More...
 
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. More...
 
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. More...
 
bool set_param_float (uint16_t id, float value)
 Sets the value of a floating point parameter by ID and calls the parameter callback. More...
 
bool set_param_int (uint16_t id, int32_t value)
 Sets the value of a parameter by ID and calls the parameter change callback. More...
 
bool write (void)
 Write current parameter values to non-volatile memory. More...
 

Static Public Attributes

static constexpr uint8_t PARAMS_NAME_LENGTH = 16
 

Private Member Functions

uint8_t compute_checksum (void)
 
void init_param_float (uint16_t id, const char name[PARAMS_NAME_LENGTH], float value)
 
void init_param_int (uint16_t id, const char name[PARAMS_NAME_LENGTH], int32_t value)
 

Private Attributes

ParamListenerInterface *const * listeners_
 
size_t num_listeners_
 
params_t params
 
ROSflightRF_
 

Detailed Description

Definition at line 222 of file param.h.

Constructor & Destructor Documentation

rosflight_firmware::Params::Params ( ROSflight _rf)

Definition at line 60 of file param.cpp.

Member Function Documentation

void rosflight_firmware::Params::change_callback ( uint16_t  id)

Callback for executing actions that need to be taken when a parameter value changes.

Parameters
idThe ID of the parameter that was changed

Definition at line 319 of file param.cpp.

uint8_t rosflight_firmware::Params::compute_checksum ( void  )
private

Definition at line 86 of file param.cpp.

float rosflight_firmware::Params::get_param_float ( uint16_t  id) const
inline

Get the value of a floating point parameter by id.

Parameters
idThe ID of the parameter
Returns
The value of the parameter

Definition at line 322 of file param.h.

int rosflight_firmware::Params::get_param_int ( uint16_t  id) const
inline

Get the value of an integer parameter by id.

Parameters
idThe ID of the parameter
Returns
The value of the parameter

Definition at line 312 of file param.h.

const char* rosflight_firmware::Params::get_param_name ( uint16_t  id) const
inline

Get the name of a parameter.

Parameters
idThe ID of the parameter
Returns
The name of the parameter

Definition at line 332 of file param.h.

param_type_t rosflight_firmware::Params::get_param_type ( uint16_t  id) const
inline

Get the type of a parameter.

Parameters
idThe ID of the parameter
Returns
The type of the parameter This returns one of three possible types PARAM_TYPE_INT32, PARAM_TYPE_FLOAT, or PARAM_TYPE_INVALID See line 165

Definition at line 345 of file param.h.

void rosflight_firmware::Params::init ( )

Initialize parameter values.

Definition at line 103 of file param.cpp.

void rosflight_firmware::Params::init_param_float ( uint16_t  id,
const char  name[PARAMS_NAME_LENGTH],
float  value 
)
private

Definition at line 77 of file param.cpp.

void rosflight_firmware::Params::init_param_int ( uint16_t  id,
const char  name[PARAMS_NAME_LENGTH],
int32_t  value 
)
private

Definition at line 68 of file param.cpp.

uint16_t rosflight_firmware::Params::lookup_param_id ( const char  name[PARAMS_NAME_LENGTH])

Gets the id of a parameter from its name.

Parameters
nameThe name of the parameter
Returns
The ID of the parameter if the name is valid, PARAMS_COUNT otherwise (invalid ID)

Definition at line 331 of file param.cpp.

bool rosflight_firmware::Params::read ( void  )

Read parameter values from non-volatile memory.

Returns
True if successful, false otherwise

Definition at line 289 of file param.cpp.

void rosflight_firmware::Params::set_defaults ( void  )

Set all parameters to default values.

Definition at line 114 of file param.cpp.

void rosflight_firmware::Params::set_listeners ( ParamListenerInterface *const  listeners[],
size_t  num_listeners 
)

Specify listeners for parameter changes.

Parameters
listenersAn array of pointers to objects that implement the ParamListenerInterface interface
num_listenersThe length of the array passed as the listeners parameter

Definition at line 283 of file param.cpp.

bool rosflight_firmware::Params::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.

Parameters
nameThe name of the parameter
valueThe new value
Returns
True if a parameter value was changed, false otherwise

Definition at line 387 of file param.cpp.

bool rosflight_firmware::Params::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.

Parameters
nameThe name of the parameter
valueThe new value
Returns
True if a parameter value was changed, false otherwise

Definition at line 381 of file param.cpp.

bool rosflight_firmware::Params::set_param_float ( uint16_t  id,
float  value 
)

Sets the value of a floating point parameter by ID and calls the parameter callback.

Parameters
idThe ID of the parameter
valueThe new value
Returns
True if a parameter was changed, false otherwise

Definition at line 369 of file param.cpp.

bool rosflight_firmware::Params::set_param_int ( uint16_t  id,
int32_t  value 
)

Sets the value of a parameter by ID and calls the parameter change callback.

Parameters
idThe ID of the parameter
valueThe new value
Returns
True if a parameter value was changed, false otherwise

Definition at line 357 of file param.cpp.

bool rosflight_firmware::Params::write ( void  )

Write current parameter values to non-volatile memory.

Returns
True if successful, false otherwise

Definition at line 306 of file param.cpp.

Member Data Documentation

ParamListenerInterface* const* rosflight_firmware::Params::listeners_
private

Definition at line 256 of file param.h.

size_t rosflight_firmware::Params::num_listeners_
private

Definition at line 257 of file param.h.

params_t rosflight_firmware::Params::params
private

Definition at line 249 of file param.h.

constexpr uint8_t rosflight_firmware::Params::PARAMS_NAME_LENGTH = 16
static

Definition at line 226 of file param.h.

ROSflight& rosflight_firmware::Params::RF_
private

Definition at line 250 of file param.h.


The documentation for this class was generated from the following files:


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:24