From 8f308ebf35ac5c50b04dffc5b26ff53ed1d6b954 Mon Sep 17 00:00:00 2001 From: Sergey Ladanov Date: Fri, 24 May 2024 08:54:45 +0300 Subject: [PATCH] add config --- Components/NVS_Lib/Inc/NVS_Cell.hpp | 5 +++-- Components/NVS_Lib/Inc/NVS_Config.h | 12 ++++++++++++ Components/NVS_Lib/Inc/NVS_Log.h | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 Components/NVS_Lib/Inc/NVS_Config.h diff --git a/Components/NVS_Lib/Inc/NVS_Cell.hpp b/Components/NVS_Lib/Inc/NVS_Cell.hpp index 44e127c..3722b08 100644 --- a/Components/NVS_Lib/Inc/NVS_Cell.hpp +++ b/Components/NVS_Lib/Inc/NVS_Cell.hpp @@ -5,6 +5,7 @@ #include #include "NVS_IFlash.hpp" #include +#include "NVS_Config.h" @@ -16,7 +17,7 @@ class NVS_Cell static constexpr uint32_t STATE_RELEASED = 0x00000000; static constexpr uint32_t TAG_START = 0x35353535; - static constexpr size_t MAX_BINARY_CELL_NUMBER = 2; + static constexpr size_t MAX_BINARY_CELL_NUMBER = NVS_CONF_MAXBINARYCELLS_COUNT; @@ -43,7 +44,7 @@ class NVS_Cell struct Header_t { uint32_t StartTag; - char Key[14]; + char Key[NVS_CONF_KEY_SIZE]; uint8_t BlockCount; uint8_t Type; union __Value diff --git a/Components/NVS_Lib/Inc/NVS_Config.h b/Components/NVS_Lib/Inc/NVS_Config.h new file mode 100644 index 0000000..7f73cb2 --- /dev/null +++ b/Components/NVS_Lib/Inc/NVS_Config.h @@ -0,0 +1,12 @@ +#ifndef __NVS_CONFIG_H__ +#define __NVS_CONFIG_H__ + + +#define NVS_CONF_DEBUG 1 + +#define NVS_CONF_MAXBINARYCELLS_COUNT 2 + +#define NVS_CONF_KEY_SIZE 14 + + +#endif /* __NVS_CONFIG_H__ */ diff --git a/Components/NVS_Lib/Inc/NVS_Log.h b/Components/NVS_Lib/Inc/NVS_Log.h index c49119b..b0b6304 100644 --- a/Components/NVS_Lib/Inc/NVS_Log.h +++ b/Components/NVS_Lib/Inc/NVS_Log.h @@ -7,10 +7,10 @@ extern "C" #endif #include "stdio.h" +#include "NVS_Config.h" -#define NVS_DEBUG 1 -#if NVS_DEBUG != 0 +#if NVS_CONF_DEBUG != 0 #define NVS_LOG(...) printf(__VA_ARGS__) #else #define NVS_LOG(TEXT, ...)