diff options
-rw-r--r-- | fw/app/CMakeLists.txt | 1 | ||||
-rw-r--r-- | fw/app/prj.conf | 9 | ||||
-rw-r--r-- | fw/app/src/settings.c | 26 |
3 files changed, 36 insertions, 0 deletions
diff --git a/fw/app/CMakeLists.txt b/fw/app/CMakeLists.txt index 1a63b77..de1c418 100644 --- a/fw/app/CMakeLists.txt +++ b/fw/app/CMakeLists.txt @@ -19,6 +19,7 @@ target_sources(app "${CMAKE_CURRENT_SOURCE_DIR}/src/http.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/ws.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/heart.c" + "${CMAKE_CURRENT_SOURCE_DIR}/src/settings.c" ) target_sources_ifdef( diff --git a/fw/app/prj.conf b/fw/app/prj.conf index eeb97a8..cd487f3 100644 --- a/fw/app/prj.conf +++ b/fw/app/prj.conf @@ -44,5 +44,14 @@ CONFIG_ZBUS=y CONFIG_ZBUS_MSG_SUBSCRIBER=y CONFIG_HEAP_MEM_POOL_SIZE=2048 +CONFIG_FLASH=y +CONFIG_FLASH_MAP=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y + +CONFIG_NVS=y +CONFIG_NVS_DATA_CRC=y + CONFIG_SETTINGS=y +CONFIG_SETTINGS_NVS=y CONFIG_SETTINGS_SHELL=y diff --git a/fw/app/src/settings.c b/fw/app/src/settings.c new file mode 100644 index 0000000..11cc162 --- /dev/null +++ b/fw/app/src/settings.c @@ -0,0 +1,26 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at https://mozilla.org/MPL/2.0/. + */ + + +#include <zephyr/init.h> +#include <zephyr/logging/log.h> +#include <zephyr/settings/settings.h> + + +LOG_MODULE_DECLARE(settings); + + +int init_settings(void) { + int ret = settings_subsys_init(); + if (ret < 0) { + LOG_ERR("Subsystem init failed (%d)", ret); + return ret; + } + LOG_INF("Subsystem initialized"); + + return 0; +} +SYS_INIT(init_settings, APPLICATION, 50); |