|
ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
|
Soil Power Sensor userConfig library. More...
Macros | |
| #define | RX_BUFFER_SIZE UserConfiguration_size |
| #define | USER_CONFIG_START_ADDRESS 1794 |
| #define | USER_CONFIG_LEN_ADDR 1792 |
Enumerations | |
| enum | UserConfigStatus { USERCONFIG_OK = 0 , USERCONFIG_FRAM_ERROR = -1 , USERCONFIG_DECODE_ERROR = -2 , USERCONFIG_NO_RESPONSE = -3 , USERCONFIG_COMM_ERROR = -4 , USERCONFIG_INVALID_RESPONSE = -5 , USERCONFIG_NOT_LOADED = -6 , USERCONFIG_EMPTY_CONFIG = -7 , USERCONFIG_ENCODE_ERROR = -8 , USERCONFIG_NULL_CONFIG = -9 } |
Functions | |
| UserConfigStatus | UserConfigLoad (void) |
| Loads user configuration data from FRAM to RAM. | |
| UserConfigStatus | UserConfigSave (const UserConfiguration *config) |
| Saves the configuration to FRAM. | |
| const UserConfiguration * | UserConfigGet (void) |
| Gets a reference to the loaded user configuration data in RAM. | |
| void | UserConfigPrintAny (const UserConfiguration *config) |
| Prints arbitrary user config over serial. | |
| void | UserConfigPrint (void) |
| Prints the current user configuration over serial. | |
| UserConfigStatus | UserConfigClear (void) |
| Clears the user configuration stored in FRAM. | |
| UserConfigStatus | UserConfigBytes (uint8_t *buffer, uint16_t *length) |
| Gets encoded bytes from userconfig. | |
| UserConfigStatus | UserConfigLoadBytes (uint8_t *buffer, uint16_t length) |
| Load user config from bytes. | |
Soil Power Sensor userConfig library.
This library provies functions for saving and loading user configurations from onboard non-volatile memory in the form of FRAM. The user configuration is assigned a block of memory where the encoded data is stored. The memory is structure in the form of [length, encoded data].
There is an optional #define TEST_USER_CONFIG that is used to guarentee a certain configuration is returned by functions for testing purposes.
| #define RX_BUFFER_SIZE UserConfiguration_size |
Definition at line 45 of file user_config.h.
| #define USER_CONFIG_LEN_ADDR 1792 |
Definition at line 49 of file user_config.h.
| #define USER_CONFIG_START_ADDRESS 1794 |
Definition at line 47 of file user_config.h.
| enum UserConfigStatus |
Definition at line 51 of file user_config.h.
| UserConfigStatus UserConfigBytes | ( | uint8_t * | buffer, |
| uint16_t * | length | ||
| ) |
Gets encoded bytes from userconfig.
| buffer | Output buffer. |
| length | Length of user config. |
Definition at line 79 of file user_config.c.
References buffer, USER_CONFIG_LEN_ADDR, USER_CONFIG_START_ADDRESS, USERCONFIG_EMPTY_CONFIG, USERCONFIG_FRAM_ERROR, USERCONFIG_OK, and UserConfig_ReadFromFRAM().
Referenced by main(), and UserConfigLoad().
| UserConfigStatus UserConfigClear | ( | void | ) |
Clears the user configuration stored in FRAM.
This function sets the userconfig to all zeros in FRAM.
Definition at line 269 of file user_config.c.
References FRAM_OK, fram_write(), USER_CONFIG_LEN_ADDR, USER_CONFIG_START_ADDRESS, USERCONFIG_FRAM_ERROR, and USERCONFIG_OK.
| const UserConfiguration * UserConfigGet | ( | void | ) |
Gets a reference to the loaded user configuration data in RAM.
This function returns a pointer to the UserConfig structure in RAM, allowing access to the loaded configuration without reading from FRAM.
Definition at line 151 of file user_config.c.
Referenced by Check(), Connect(), ControllerUserConfigSend(), main(), measure_sensor(), StartUploads(), UserConfigPrint(), and UserConfigStopCallback().
| UserConfigStatus UserConfigLoad | ( | void | ) |
Loads user configuration data from FRAM to RAM.
This function reads the stored user configuration data from FRAM, decodes it, and loads it into RAM. The data will be stored in a static UserConfig structure.
get bytes
Definition at line 124 of file user_config.c.
References buffer, USERCONFIG_OK, UserConfigBytes(), and UserConfigLoadBytes().
Referenced by main(), UserConfigStart(), and UserConfigUpdateFromServer().
| UserConfigStatus UserConfigLoadBytes | ( | uint8_t * | buffer, |
| uint16_t | length | ||
| ) |
Load user config from bytes.
| buffer | User config bytes. |
| length | Length of buffer. |
Definition at line 113 of file user_config.c.
References buffer, DecodeUserConfiguration(), USERCONFIG_DECODE_ERROR, and USERCONFIG_OK.
Referenced by load_userconfig(), and UserConfigLoad().
| void UserConfigPrint | ( | void | ) |
Prints the current user configuration over serial.
Definition at line 263 of file user_config.c.
References UserConfigGet(), and UserConfigPrintAny().
Referenced by main(), UserConfigStart(), and UserConfigUpdateFromServer().
| void UserConfigPrintAny | ( | const UserConfiguration * | config | ) |
Prints arbitrary user config over serial.
The printing/formatting is done with APP_LOG functions requiring SystemApp_Init() to be called before this function can be used.
Definition at line 188 of file user_config.c.
References i.
Referenced by UserConfigPrint().
| UserConfigStatus UserConfigSave | ( | const UserConfiguration * | config | ) |
Saves the configuration to FRAM.
| config | Pointer to the UserConfiguration structure to save. |
Definition at line 159 of file user_config.c.
References EncodeUserConfiguration(), USER_CONFIG_LEN_ADDR, USER_CONFIG_START_ADDRESS, USERCONFIG_ENCODE_ERROR, USERCONFIG_NULL_CONFIG, USERCONFIG_OK, and UserConfig_WriteToFRAM().
Referenced by ControllerUserConfigRequest(), and main().