dp_conf.h

Configuartion Module for DuinoPro (DP)

Handles dynamic configuration of DP

Date
2017/10/01
Author
Jamie K. Phan

Defines

DP_LUT__N_PARAM
DP_LUT__COL_FIELD_LEN
DP_LUT__COL_MAX_VAL
DP_LUT__COL_MIN_VAL
LUT_IDX__LOG_LEVEL
LUT_IDX__SAMPLE_PERIOD
LUT_IDX__SLEEP_OVERHEAD
LUT_IDX__SENSOR_COMM_TYPE
LUT_IDX__SENSOR_RESOLUTION
LUT_IDX__SENSOR_CLK_SPEED
LUT_IDX__WSN_JOIN_DC_INIT
LUT_IDX__WSN_JOIN_DC_DECR
LUT_IDX__WSN_JOIN_WAIT_INIT
LUT_IDX__WSN_JOIN_WAIT_INCR
LUT_IDX__SLEEP_GUARD_TIMEOUT

Functions

uint8_t dp_conf_set(char *)

Ensures configuration parameters are set. If not set, default parameters are loaded from non-volatile memory. Once set, if a packet payload is passed as an argument, then the payload is parsed and the parameters contained therein are updated accordingly.

Return
0 on success, 1 on failure
Parameters
  • package_payload: The full packet payload received in a configuration packet sent by the Dusty network manager

uint8_t dp_conf_default(void)

Loads configuration from non-volatile memory and sets their values in volatile memory.

Default configurations will be set in non-volatile memory to ensure that the device does not need to rely on a central host to broadcast configuration information at startup. This will drastically reduce network startup loads.

Return
0 on success, 1 on failure

uint8_t dp_conf_param_set(uint8_t, uint8_t)

Set the parameter’s value in volatile memory.

Return
0 on success, 1 on failure
Parameters
  • param: the parameter type byte received in the configuration packet
  • value: the parameter value byte(s) received in the configuration packet

uint8_t dp_conf_param_get_cur(uint8_t)

Get the current value of the param set in volatile memory.

Return
the current value of the parameter
Parameters
  • param: the parameter index

uint8_t dp_conf_param_lookup_max(uint8_t)

Get a parameter’s maximum allowable value.

This should be privately called

Return
the maximum value of the parameter
Parameters
  • param: the parameter index

uint8_t dp_conf_param_lookup_min(uint8_t)

Get a parameter’s minimum allowable value.

This should be privately called

Return
the minimum value of the parameter
Parameters
  • param: the parameter index