Chapter 2. API Reference
Structures
struct nvs_sec_cfg_t
Key for encryption and decryption.
Public Members
uint8_t eky[NVS_KEY_SIZE]
XTS encryption and decryption key
uint8_t tky[NVS_KEY_SIZE]
XTS tweak key
Macros
NVS_KEY_SIZE
Header File
•
components/nvs_flash/include/nvs.h
Functions
esp_err_t nvs_set_i8(nvs_handle_t
set int8_t value for given key
Set value for the key, given its name. Note that the actual storage will not be updated until nvs_commit is
called.
Return
• ESP_OK if value was set successfully
• ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL
• ESP_ERR_NVS_READ_ONLY if storage handle was opened as read only
• ESP_ERR_NVS_INVALID_NAME if key name doesn't satisfy constraints
• ESP_ERR_NVS_NOT_ENOUGH_SPACE if there is not enough space in the underlying storage
to save the value
• ESP_ERR_NVS_REMOVE_FAILED if the value wasn't updated because flash write operation
has failed. The value was written however, and update will be finished after re-initialization of nvs,
provided that flash operation doesn't fail again.
Parameters
• [in] handle: Handle obtained from nvs_open function. Handles that were opened read only
cannot be used.
• [in] key: Key name. Maximal length is (NVS_KEY_NAME_MAX_SIZE-1) characters.
Shouldn't be empty.
• [in] value: The value to set.
esp_err_t nvs_set_u8(nvs_handle_t
set uint8_t value for given key
This function is the same as nvs_set_i8 except for the data type.
esp_err_t nvs_set_i16(nvs_handle_t
set int16_t value for given key
This function is the same as nvs_set_i8 except for the data type.
esp_err_t nvs_set_u16(nvs_handle_t
set uint16_t value for given key
This function is the same as nvs_set_i8 except for the data type.
esp_err_t nvs_set_i32(nvs_handle_t
set int32_t value for given key
This function is the same as nvs_set_i8 except for the data type.
Espressif Systems
handle, const char *key, int8_t value)
handle, const char *key, uint8_t value)
handle, const char *key, int16_t value)
handle, const char *key, uint16_t value)
handle, const char *key, int32_t value)
715
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers