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:
parent
de70e9c5ba
commit
6c218ac2c6
1 changed files with 11 additions and 11 deletions
|
@ -141,12 +141,6 @@ export functionality, for example, writing to the shell console).
|
||||||
|
|
||||||
static int8 foo_val = DEFAULT_FOO_VAL_VALUE;
|
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,
|
static int foo_settings_set(const char *name, size_t len,
|
||||||
settings_read_cb read_cb, void *cb_arg)
|
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));
|
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
|
Example: Persist Runtime State
|
||||||
******************************
|
******************************
|
||||||
|
|
||||||
|
@ -197,11 +197,6 @@ up from where it was before restart.
|
||||||
|
|
||||||
static int8 foo_val = DEFAULT_FOO_VAL_VALUE;
|
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,
|
static int foo_settings_set(const char *name, size_t len,
|
||||||
settings_read_cb read_cb, void *cb_arg)
|
settings_read_cb read_cb, void *cb_arg)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +231,11 @@ up from where it was before restart.
|
||||||
sys_reboot(SYS_REBOOT_COLD);
|
sys_reboot(SYS_REBOOT_COLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct settings_handler my_conf = {
|
||||||
|
.name = "foo",
|
||||||
|
.h_set = foo_settings_set
|
||||||
|
};
|
||||||
|
|
||||||
Example: Custom Backend Implementation
|
Example: Custom Backend Implementation
|
||||||
**************************************
|
**************************************
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue