doc/reference/runtime_conf: improve example snippets

Improve settings example snippets by ordering things so that they
actually compile.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
This commit is contained in:
Jacob Siverskog 2020-02-05 09:36:35 +01:00 committed by Anas Nashif
parent de70e9c5ba
commit 6c218ac2c6

View file

@ -141,12 +141,6 @@ export functionality, for example, writing to the shell console).
static int8 foo_val = DEFAULT_FOO_VAL_VALUE;
struct settings_handler my_conf = {
.name = "foo",
.h_set = foo_settings_set,
.h_export = foo_settings_export
};
static int foo_settings_set(const char *name, size_t len,
settings_read_cb read_cb, void *cb_arg)
{
@ -179,6 +173,12 @@ export functionality, for example, writing to the shell console).
return storage_func("foo/bar", &foo_val, sizeof(foo_val));
}
struct settings_handler my_conf = {
.name = "foo",
.h_set = foo_settings_set,
.h_export = foo_settings_export
};
Example: Persist Runtime State
******************************
@ -197,11 +197,6 @@ up from where it was before restart.
static int8 foo_val = DEFAULT_FOO_VAL_VALUE;
struct settings_handler my_conf = {
.name = "foo",
.h_set = foo_settings_set
};
static int foo_settings_set(const char *name, size_t len,
settings_read_cb read_cb, void *cb_arg)
{
@ -236,6 +231,11 @@ up from where it was before restart.
sys_reboot(SYS_REBOOT_COLD);
}
struct settings_handler my_conf = {
.name = "foo",
.h_set = foo_settings_set
};
Example: Custom Backend Implementation
**************************************