Espressif ESP32-S2 Programming Manual page 722

Table of Contents

Advertisement

Chapter 2. API Reference
|
--+
+-> Fixed length --
|
----------+-------+
|
ChunkStart(1) | Rsv(2)|
Data format ---+
----------+-------+
|
|
+->
Individual fields in entry structure have the following meanings:
NS Namespace index for this entry. For more information on this value, see the section on namespaces implemen-
tation.
Type One byte indicating the value data type. See the ItemType enumeration in
for possible values.
Span Number of entries used by this key-value pair. For integer types, this is equal to 1. For strings and blobs, this
depends on value length.
ChunkIndex Used to store the index of a blob-data chunk for blob types. For other types, this should be 0xff.
CRC32 Checksum calculated over all the bytes in this entry, except for the CRC32 field itself.
Key Zero-terminated ASCII string containing a key name. Maximum string length is 15 bytes, excluding a zero
terminator.
Data For integer types, this field contains the value itself. If the value itself is shorter than 8 bytes, it is padded to
the right, with unused bytes filled with 0xff.
For "blob index"entry, these 8 bytes hold the following information about data-chunks:
• Size (Only for blob index.) Size, in bytes, of complete blob data.
• ChunkCount (Only for blob index.) Total number of blob-data chunks into which the blob was divided
during storage.
• ChunkStart (Only for blob index.) ChunkIndex of the first blob-data chunk of this blob. Subsequent
chunks have chunkIndex incrementally allocated (step of 1).
For string and blob data chunks, these 8 bytes hold additional data about the value, which are described below:
• Size (Only for strings and blobs.) Size, in bytes, of actual data. For strings, this includes zero terminators.
• CRC32 (Only for strings and blobs.) Checksum calculated over all bytes of data.
Variable length values (strings and blobs) are written into subsequent entries, 32 bytes per entry. The Span field of
the first entry indicates how many entries are used.
Namespaces
As mentioned above, each key-value pair belongs to one of the namespaces. Namespace identifiers
(strings) are stored as keys of key-value pairs in namespace with index 0. Values corresponding to these keys are
indexes of these namespaces.
+-------------------------------------------+
| NS=0 Type=uint8_t Key="wifi" Value=1
+-------------------------------------------+
| NS=1 Type=uint32_t Key="channel" Value=6
+-------------------------------------------+
| NS=0 Type=uint8_t Key="pwm" Value=2
+-------------------------------------------+
| NS=2 Type=uint16_t Key="channel" Value=20 |
+-------------------------------------------+
Espressif Systems
+-------->
| Types
|
+-------->
Blob Index
Variable length
-->
(Strings, Blob Data)
711
Submit Document Feedback
|
Data (8)
+------------------------------
+---------+--------------+-----
| Size(4) |
+---------+--------------+-----
+----------+---------+-----------+
| Size (2) | Rsv (2) | CRC32 (4) |
+----------+---------+-----------+
nvs_flash/include/nvs_handle.hpp
|
Entry describing namespace "wifi"
|
Key "channel" in namespace "wifi"
|
Entry describing namespace "pwm"
Key "channel" in namespace "pwm"
(continued from previous page)
ChunkCount(1)|␣
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Table of Contents

Save PDF