EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #729 background imageLoading...
Page #729 background image
Chapter 2. API Reference
(continued from previous page)
size_t size = sizeof(mac_addr);
nvs_get_blob(my_handle, "dst_mac_addr", mac_addr, &size);
Return
ESP_OK if the value was retrieved successfully
ESP_ERR_NVS_NOT_FOUND if the requested key doesnt exist
ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL
ESP_ERR_NVS_INVALID_NAME if key name doesnt satisfy constraints
ESP_ERR_NVS_INVALID_LENGTH if length is not sufficient to store data
Parameters
[in] handle: Handle obtained from nvs_open function.
[in] key: Key name. Maximal length is (NVS_KEY_NAME_MAX_SIZE-1) characters.
Shouldnt be empty.
[out] out_value: Pointer to the output value. May be NULL for nvs_get_str and
nvs_get_blob, in this case required length will be returned in length argument.
[inout] length: A non-zero pointer to the variable holding the length of out_value. In case
out_value a zero, will be set to the length required to hold the value. In case out_value is not zero,
will be set to the actual length of the value written. For nvs_get_str this includes zero terminator.
esp_err_t nvs_get_blob(nvs_handle_t handle, const char *key, void *out_value, size_t *length)
get blob value for given key
This function behaves the same as nvs_get_str, except for the data type.
esp_err_t nvs_open(const char *name, nvs_open_mode_t open_mode, nvs_handle_t *out_handle)
Open non-volatile storage with a given namespace from the default NVS partition.
Multiple internal ESP-IDF and third party application modules can store their key-value pairs in the NVS
module. In order to reduce possible conflicts on key names, each module can use its own namespace. The
default NVS partition is the one that is labelled nvsin the partition table.
Return
ESP_OK if storage handle was opened successfully
ESP_ERR_NVS_NOT_INITIALIZED if the storage driver is not initialized
ESP_ERR_NVS_PART_NOT_FOUND if the partition with label nvsis not found
ESP_ERR_NVS_NOT_FOUND id namespace doesnt exist yet and mode is NVS_READONLY
ESP_ERR_NVS_INVALID_NAME if namespace name doesnt satisfy constraints
ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures
other error codes from the underlying storage driver
Parameters
[in] name: Namespace name. Maximal length is (NVS_KEY_NAME_MAX_SIZE-1) charac-
ters. Shouldnt be empty.
[in] open_mode: NVS_READWRITE or NVS_READONLY. If NVS_READONLY, will
open a handle for reading only. All write requests will be rejected for this handle.
[out] out_handle: If successful (return code is zero), handle will be returned in this argument.
esp_err_t nvs_open_from_partition(const char *part_name, const char *name,
nvs_open_mode_t open_mode, nvs_handle_t *out_handle)
Open non-volatile storage with a given namespace from specified partition.
The behaviour is same as nvs_open() API. However this API can operate on a specified NVS partition
instead of default NVS partition. Note that the specified partition must be registered with NVS using
nvs_flash_init_partition() API.
Return
ESP_OK if storage handle was opened successfully
ESP_ERR_NVS_NOT_INITIALIZED if the storage driver is not initialized
ESP_ERR_NVS_PART_NOT_FOUND if the partition with specied name is not found
ESP_ERR_NVS_NOT_FOUND id namespace doesnt exist yet and mode is NVS_READONLY
ESP_ERR_NVS_INVALID_NAME if namespace name doesnt satisfy constraints
ESP_ERR_NO_MEM in case memory could not be allocated for the internal structures
Espressif Systems 718
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish