You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #1803 from petermm/fix-nvs-docs
Fix: nvs docs Programmers guide
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Copy file name to clipboardExpand all lines: doc/src/programmers-guide.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1085,36 +1085,36 @@ storage, as the flash storage may degrade more rapidly with repeated writes to t
1085
1085
1086
1086
NVS entries are stored under a namespace and key, both of which are expressed as atoms. AtomVM uses the namespace `atomvm` for entries under its control. Applications may read from and write to the `atomvm` namespace, but they are strongly discouraged from doing so, except when explicitly stated otherwise.
1087
1087
1088
-
To set a value in non-volatile storage, use the [`esp:nvs_set_binary/3`](./apidocs/erlang/eavmlib/esp.md#nvs_set_binary3) function, and specify a namespace, key, and value:
1088
+
To set a value in non-volatile storage, use the [`esp:nvs_put_binary/3`](./apidocs/erlang/eavmlib/esp.md#nvs_put_binary3) function, and specify a namespace, key, and value:
To retrieve a value in non-volatile storage, use the [`esp:nvs_get_binary/2`](./apidocs/erlang/eavmlib/esp.md#nvs_get_binary2) function, and specify a namespace and key. You can optionally specify a default value (of any desired type), if an entry does not exist in non-volatile storage:
1097
1097
1098
1098
```erlang
1099
-
Value = esp:get_binary(Namespace, Key, <<"default-value">>).
1099
+
Value = esp:nvs_get_binary(Namespace, Key, <<"default-value">>).
1100
1100
```
1101
1101
1102
1102
To delete an entry, use the [`esp:nvs_erase_key/2`](./apidocs/erlang/eavmlib/esp.md#nvs_erase_key2) function, and specify a namespace and key:
1103
1103
1104
1104
```erlang
1105
-
ok = esp:erase_key(Namespace, Key).
1105
+
ok = esp:nvs_erase_key(Namespace, Key).
1106
1106
```
1107
1107
1108
1108
You can delete all entries in a namespace via the [`esp:nvs_erase_all/1`](./apidocs/erlang/eavmlib/esp.md#nvs_erase_all1) function:
1109
1109
1110
1110
```erlang
1111
-
ok = esp:erase_all(Namespace).
1111
+
ok = esp:nvs_erase_all(Namespace).
1112
1112
```
1113
1113
1114
1114
Finally, you can delete all entries in all namespaces on the NVS partition via the [`esp:nvs_reformat/0`](./apidocs/erlang/eavmlib/esp.md#nvs_reformat0) function:
1115
1115
1116
1116
```erlang
1117
-
ok = esp:reformat().
1117
+
ok = esp:nvs_reformat().
1118
1118
```
1119
1119
1120
1120
Applications should use the `esp:nvs_reformat/0` function with caution, in case other applications are making using the non-volatile storage.
0 commit comments