Skip to content

Commit

Permalink
Merge pull request #759 from bettio/fix-nvs_set_binary
Browse files Browse the repository at this point in the history
ESP32/NVS: fix nvs_set_binary

In order to execute the NIF, an extern call must be done.

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
  • Loading branch information
bettio committed Aug 14, 2023
2 parents b038628 + 671a61f commit d995f51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.6.0-alpha.1] - Unreleased

### Fixed

- Fixed `esp:nvs_set_binary` functions.

## [0.6.0-alpha.0] - 2023-08-13

### Added
Expand Down
4 changes: 2 additions & 2 deletions libs/eavmlib/src/esp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ nvs_get_binary(Namespace, Key, Default) when
%%-----------------------------------------------------------------------------
-spec nvs_set_binary(Key :: atom(), Value :: binary()) -> ok.
nvs_set_binary(Key, Value) when is_atom(Key) andalso is_binary(Value) ->
esp:nvs_set_binary(?ATOMVM_NVS_NS, Key, Value).
nvs_set_binary(?ATOMVM_NVS_NS, Key, Value).

%%-----------------------------------------------------------------------------
%% @param Namespace NVS namespace
Expand All @@ -229,7 +229,7 @@ nvs_set_binary(Key, Value) when is_atom(Key) andalso is_binary(Value) ->
nvs_set_binary(Namespace, Key, Value) when
is_atom(Namespace) andalso is_atom(Key) andalso is_binary(Value)
->
nvs_put_binary(Namespace, Key, Value).
esp:nvs_put_binary(Namespace, Key, Value).

%%-----------------------------------------------------------------------------
%% @param Namespace NVS namespace
Expand Down

0 comments on commit d995f51

Please sign in to comment.