README.rst
1.. zephyr:code-sample:: settings
2 :name: Settings API
3 :relevant-api: settings settings_rt settings_name_proc
4
5 Load and save configuration values using the settings API.
6
7Overview
8********
9
10This is a simple application demonstrating use of the settings runtime
11configuration module. In this application some configuration values are loaded
12from persistent storage and exported to persistent storage using different
13settings method. The example shows how to implement module handlers, how to
14register them.
15
16Requirements
17************
18
19* A board with settings support, for instance: nrf52840dk/nrf52840
20* Or qemu_x86 target
21* A nvs_sector_size <= 0xFFFF
22
23Building and Running
24********************
25
26The sample can be built for several platforms, the following commands build the
27application for the qemu_x86.
28
29.. zephyr-app-commands::
30 :zephyr-app: samples/subsys/settings
31 :host-os: unix
32 :board: qemu_x86
33 :goals: run
34 :compact:
35
36After running the image to the board the output on the console shows the
37settings manipulation messages.
38
39Sample Output
40=============
41
42.. code-block:: console
43
44 ***** Booting Zephyr OS build v2.1.0-rc1-123-g41091eb1d5e0 *****
45
46 *** Settings usage example ***
47
48 settings subsys initialization: OK.
49 subtree <alpha> handler registered: OK
50 subtree <alpha/beta> has static handler
51
52 ##############
53 # iteration 0
54 ##############
55
56 =================================================
57 basic load and save using registered handlers
58
59 load all key-value pairs using registered handlers
60 loading all settings under <beta> handler is done
61 loading all settings under <alpha> handler is done
62
63 save <alpha/beta/voltage> key directly: OK.
64
65 load <alpha/beta> key-value pairs using registered handlers
66 <alpha/beta/voltage> = -3025
67 loading all settings under <beta> handler is done
68
69 save all key-value pairs using registered handlers
70 export keys under <beta> handler
71 export keys under <alpha> handler
72
73 load all key-value pairs using registered handlers
74 export keys under <beta> handler
75 export keys under <alpha> handler
76
77 =================================================
78 loading subtree to destination provided by the caller
79
80 direct load: <alpha/length/2>
81 direct load: <alpha/length/1>
82 direct load: <alpha/length>
83 direct.length = 100
84 direct.length_1 = 41
85 direct.length_2 = 59
86
87 =================================================
88 Delete a key-value pair
89
90 immediate load: OK.
91 <alpha/length> value exist in the storage
92 delete <alpha/length>: OK.
93 Can't to load the <alpha/length> value as expected
94
95 =================================================
96 Service a key-value pair without dedicated handlers
97
98 <gamma> = 0 (default)
99 save <gamma> key directly: OK.
100 ...
101