Settings loader module¶
Use the settings loader module to trigger loading the data from non-volatile memory.
Module events¶
Source Module |
Input Event |
This Module |
Output Event |
Sink Module |
---|---|---|---|---|
|
|
|||
|
Note
See the Overview: Firmware architecture for more information about the event-based communication in the nRF Desktop application and about how to read this table.
Configuration¶
The settings loader module is enabled for every nRF Desktop device with Zephyr’s Settings enabled.
The Settings subsystem is enabled with the CONFIG_SETTINGS
Kconfig option.
Zephyr’s Bluetooth® stack does not load the Settings data on its own.
Zephyr assumes that the application will call settings_load()
after completing all necessary initialization.
This function is called on the settings loader module initialization.
Note
Make sure that all settings handlers are registered and bt_enable()
is called before the settings loader module is initialized.
Settings are by default loaded in the system workqueue context.
This blocks the workqueue until the operation is finished.
You can set the CONFIG_DESKTOP_SETTINGS_LOADER_USE_THREAD
Kconfig option to load the settings in a separate thread in the background instead of using the system workqueue for that purpose.
This will prevent blocking the system workqueue, but it requires creating an additional thread.
The stack size for the background thread is defined as CONFIG_DESKTOP_SETTINGS_LOADER_THREAD_STACK_SIZE
.
Tip
Using separate thread is recommended for nRF Desktop keyboards.
The CAF: Buttons module uses the system workqueue to scan the keyboard matrix.
Loading the settings in the system workqueue context could block the workqueue and result in missing key presses on system reboot.
For this reason, CONFIG_DESKTOP_SETTINGS_LOADER_USE_THREAD
is enabled for keyboard reference design (nRF52832 Desktop Keyboard)