HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
EspTypes_NVS.h File Reference

ESP32 NVS type definitions for hardware abstraction. More...

#include "BaseNvs.h"
#include "EspTypes_Base.h"
#include "HardwareTypes.h"
#include "McuSelect.h"
#include <cstring>
Include dependency graph for EspTypes_NVS.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  hf_nvs_partition_config_t
 ESP32 NVS partition configuration. More...
 
struct  hf_nvs_capabilities_t
 ESP32 NVS capabilities information. More...
 
struct  hf_nvs_iterator_config_t
 ESP32 NVS iterator configuration. More...
 
struct  hf_nvs_entry_info_t
 ESP32 NVS entry information. More...
 

Macros

#define HF_NVS_IS_VALID_KEY_LENGTH(len)   ((len) > 0 && (len) <= HF_NVS_MAX_KEY_LENGTH)
 
#define HF_NVS_IS_VALID_VALUE_SIZE(size)   ((size) <= HF_NVS_MAX_VALUE_SIZE)
 
#define HF_NVS_IS_VALID_NAMESPACE_LENGTH(len)   ((len) > 0 && (len) <= HF_NVS_MAX_NAMESPACE_LENGTH)
 

Enumerations

enum class  hf_nvs_type_t : uint8_t {
  HF_NVS_TYPE_U8 = 0 , HF_NVS_TYPE_I8 = 1 , HF_NVS_TYPE_U16 = 2 , HF_NVS_TYPE_I16 = 3 ,
  HF_NVS_TYPE_U32 = 4 , HF_NVS_TYPE_I32 = 5 , HF_NVS_TYPE_U64 = 6 , HF_NVS_TYPE_I64 = 7 ,
  HF_NVS_TYPE_STR = 8 , HF_NVS_TYPE_BLOB = 9
}
 ESP32 NVS data types. More...
 
enum class  hf_nvs_open_mode_t : uint8_t { HF_NVS_READONLY = 0 , HF_NVS_READWRITE = 1 }
 ESP32 NVS open modes. More...
 
enum class  hf_nvs_encryption_mode_t : uint8_t { HF_NVS_ENCRYPTION_NONE = 0 , HF_NVS_ENCRYPTION_HMAC = 1 , HF_NVS_ENCRYPTION_XTS = 2 }
 ESP32 NVS encryption modes. More...
 

Functions

constexpr bool IsValidNvsKey (const char *key) noexcept
 Validate NVS key name for ESP32.
 
constexpr bool IsValidNvsNamespace (const char *namespace_name) noexcept
 Validate NVS namespace name for ESP32.
 
constexpr bool IsValidNvsValueSize (size_t size) noexcept
 Validate NVS value size for ESP32.
 
constexpr size_t GetMaxValueSizeForType (hf_nvs_type_t type) noexcept
 Get maximum supported value size for given type.
 

Variables

static constexpr size_t HF_NVS_MAX_KEY_LENGTH = 15
 
static constexpr size_t HF_NVS_MAX_VALUE_SIZE = 4000
 
static constexpr size_t HF_NVS_MAX_NAMESPACE_LENGTH = 15
 
static constexpr size_t HF_NVS_MAX_NAMESPACES = 256
 
static constexpr size_t HF_NVS_FLASH_SECTOR_SIZE = 4096
 
static constexpr size_t HF_NVS_PAGE_SIZE = 4096
 
static constexpr size_t HF_NVS_ENTRY_SIZE = 32
 
static constexpr uint32_t HF_NVS_OPERATION_TIMEOUT_MS = 1000
 Default operation timeout.
 
static constexpr uint32_t HF_NVS_INIT_TIMEOUT_MS = 5000
 Initialization timeout.
 
static constexpr uint32_t HF_NVS_COMMIT_TIMEOUT_MS = 2000
 Commit operation timeout.
 

Detailed Description

ESP32 NVS type definitions for hardware abstraction.

This header defines only the essential NVS-specific types used by the EspNvs implementation. Clean and minimal approach.

Author
Nebiyu Tadesse
Date
2025

Macro Definition Documentation

◆ HF_NVS_IS_VALID_KEY_LENGTH

#define HF_NVS_IS_VALID_KEY_LENGTH ( len)    ((len) > 0 && (len) <= HF_NVS_MAX_KEY_LENGTH)

◆ HF_NVS_IS_VALID_NAMESPACE_LENGTH

#define HF_NVS_IS_VALID_NAMESPACE_LENGTH ( len)    ((len) > 0 && (len) <= HF_NVS_MAX_NAMESPACE_LENGTH)

◆ HF_NVS_IS_VALID_VALUE_SIZE

#define HF_NVS_IS_VALID_VALUE_SIZE ( size)    ((size) <= HF_NVS_MAX_VALUE_SIZE)

Enumeration Type Documentation

◆ hf_nvs_encryption_mode_t

enum class hf_nvs_encryption_mode_t : uint8_t
strong

ESP32 NVS encryption modes.

Enumerator
HF_NVS_ENCRYPTION_NONE 

No encryption.

HF_NVS_ENCRYPTION_HMAC 

HMAC encryption.

HF_NVS_ENCRYPTION_XTS 

XTS encryption.

◆ hf_nvs_open_mode_t

enum class hf_nvs_open_mode_t : uint8_t
strong

ESP32 NVS open modes.

Enumerator
HF_NVS_READONLY 

Read-only mode.

HF_NVS_READWRITE 

Read-write mode.

◆ hf_nvs_type_t

enum class hf_nvs_type_t : uint8_t
strong

ESP32 NVS data types.

Enumerator
HF_NVS_TYPE_U8 

8-bit unsigned integer

HF_NVS_TYPE_I8 

8-bit signed integer

HF_NVS_TYPE_U16 

16-bit unsigned integer

HF_NVS_TYPE_I16 

16-bit signed integer

HF_NVS_TYPE_U32 

32-bit unsigned integer

HF_NVS_TYPE_I32 

32-bit signed integer

HF_NVS_TYPE_U64 

64-bit unsigned integer

HF_NVS_TYPE_I64 

64-bit signed integer

HF_NVS_TYPE_STR 

String.

HF_NVS_TYPE_BLOB 

Binary blob.

Function Documentation

◆ GetMaxValueSizeForType()

constexpr size_t GetMaxValueSizeForType ( hf_nvs_type_t type)
inlineconstexprnoexcept

Get maximum supported value size for given type.

Parameters
typeNVS data type
Returns
Maximum size in bytes

◆ IsValidNvsKey()

constexpr bool IsValidNvsKey ( const char * key)
inlineconstexprnoexcept

Validate NVS key name for ESP32.

Parameters
keyKey name to validate
Returns
true if valid, false otherwise

◆ IsValidNvsNamespace()

constexpr bool IsValidNvsNamespace ( const char * namespace_name)
inlineconstexprnoexcept

Validate NVS namespace name for ESP32.

Parameters
namespace_nameNamespace name to validate
Returns
true if valid, false otherwise

◆ IsValidNvsValueSize()

constexpr bool IsValidNvsValueSize ( size_t size)
inlineconstexprnoexcept

Validate NVS value size for ESP32.

Parameters
sizeValue size to validate
Returns
true if valid, false otherwise

Variable Documentation

◆ HF_NVS_COMMIT_TIMEOUT_MS

constexpr uint32_t HF_NVS_COMMIT_TIMEOUT_MS = 2000
staticconstexpr

Commit operation timeout.

◆ HF_NVS_ENTRY_SIZE

constexpr size_t HF_NVS_ENTRY_SIZE = 32
staticconstexpr

◆ HF_NVS_FLASH_SECTOR_SIZE

constexpr size_t HF_NVS_FLASH_SECTOR_SIZE = 4096
staticconstexpr

◆ HF_NVS_INIT_TIMEOUT_MS

constexpr uint32_t HF_NVS_INIT_TIMEOUT_MS = 5000
staticconstexpr

Initialization timeout.

◆ HF_NVS_MAX_KEY_LENGTH

constexpr size_t HF_NVS_MAX_KEY_LENGTH = 15
staticconstexpr

◆ HF_NVS_MAX_NAMESPACE_LENGTH

constexpr size_t HF_NVS_MAX_NAMESPACE_LENGTH = 15
staticconstexpr

◆ HF_NVS_MAX_NAMESPACES

constexpr size_t HF_NVS_MAX_NAMESPACES = 256
staticconstexpr

◆ HF_NVS_MAX_VALUE_SIZE

constexpr size_t HF_NVS_MAX_VALUE_SIZE = 4000
staticconstexpr

◆ HF_NVS_OPERATION_TIMEOUT_MS

constexpr uint32_t HF_NVS_OPERATION_TIMEOUT_MS = 1000
staticconstexpr

Default operation timeout.

◆ HF_NVS_PAGE_SIZE

constexpr size_t HF_NVS_PAGE_SIZE = 4096
staticconstexpr