STG (Settings) Library
|Top Previous Next|
The STG library offers a persistent, convenient storage for your device's settings (operational parameters). It can also play a pivotal role in the device control and monitoring. The library is extremely easy to use — just define a list of all desired settings using a setting configurator and employ simple API calls to work with them.
Setting configurator allows you to specify the names, types, value constraints, etc. of your device's settings and the STG library uses this to automatically calculate memory addresses for storing settings, protect the settings with a checksum, verify the validity of their values, etc. You code is then able to reference setting values by their names, like this: s=stg_get("IP",0), stg_set("IP",0,"192.168.1.40").
The library keeps your settings in the non-volatile memory or RAM. The non-volatile memory used can be the EEPROM memory (stor.) or the flash disk (fd.). For RAM, you can choose to go with "regular" RAM (the one that stores variables), or "custom" RAM, for which you can create your own access routines.