EasyManua.ls Logo

Espressif ESP32-S2 - Page 722

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
Loading...
Chapter 2. API Reference
(continued from previous page)
+--------> | Data (8)
, |
| Types +------------------------------
,--+
+-> Fixed length --
| | +---------+--------------+-----
,----------+-------+
| +--------> | Size(4) | ChunkCount(1)|
,ChunkStart(1) | Rsv(2)|
Data format ---+ Blob Index +---------+--------------+-----
,----------+-------+
|
| +----------+---------+-----------+
+-> Variable length --> | Size (2) | Rsv (2) | CRC32 (4) |
(Strings, Blob Data) +----------+---------+-----------+
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 nvs_flash/include/nvs_handle.hpp
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 indexentry, 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 eld 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 | Entry describing namespace "wifi"
+-------------------------------------------+
| NS=1 Type=uint32_t Key="channel" Value=6 | Key "channel" in namespace "wifi"
+-------------------------------------------+
| NS=0 Type=uint8_t Key="pwm" Value=2 | Entry describing namespace "pwm"
+-------------------------------------------+
| NS=2 Type=uint16_t Key="channel" Value=20 | Key "channel" in namespace "pwm"
+-------------------------------------------+
Espressif Systems 711
Submit Document Feedback
Release v4.4

Table of Contents