zephyr settings part 4: CAF settings module,
TODO: check the use of : settingsruntimeset, settingsruntimeget CAF settings loader module: takes care of settings initialization ( settingssubsysinit ) and settingsload automatically. Don't know if it works without SETTINGSSTATICHANDLERDEFINE, docs: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/caf/settings_loader.html CONCLUSION: settings works but is really shitty because of very limited documentation and the need to implement handlers for parsing the keys wit...
Read post
zephyr settings part 3: persistence of multiple key-values at once (handler)
LOAD MULTIPLE VARIABLES AT ONCE EXAMPLE: direct_length_data: your structure variable that will be set: struct direct_length_data { uint64_t length; uint16_t length_1; uint32_t length_2; }; the handler: direct_loader static int direct_loader(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg, void *param) { const char *next; size_t name_len; int rc; struct direct_length_data *dest = (struct direct_length_data *)param; printk("di...
Read post
zephyr settings part 2: persistence of multiple key-values (handler)
(modified code from the settings sample https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/subsys/settings ) I wondered how "settings" knew about the keys it had to load. Some tests showed that it "auto-finds" out the keys reading the storage. So be sure to define default values for your new keys because they will only "exist" for "settings" once they have been stored. It is recommended to erase the board once you have made changes to your settings in your code (variable type, keys name...
Read post
zephyr settings part 1: persistence of single key-value (no handler)
(code taken from the settings sample https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/subsys/settings ) At first I used settings (key-values) with littlefs but testing showed that files got corrupted when the board was suddenly powered off. That didn't happen with NVS so for me NVS is more failsafe then littlefs. It's a lot of plumbery... proj.conf: CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_SETTINGS=y CONFIG_SETTINGS_RUNTIME=y CONFIG_SETTINGS_LOG_LEVEL_INF...
Read post