8000 esp32/nvs: exclude NVS from esp-idf v3 · micropython/micropython@5e81d99 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e81d99

Browse files
committed
esp32/nvs: exclude NVS from esp-idf v3
1 parent 28032f5 commit 5e81d99

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

ports/esp32/esp32_nvs.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "nvs_flash.h"
3434
#include "nvs.h"
3535

36+
37+
#if MICROPY_ESP_IDF_4
3638
// This file implements the NVS (Non-Volatile Storage) class in the esp32 module.
3739
// It provides simple access to the NVS feature provided by ESP-IDF.
3840

@@ -149,3 +151,22 @@ const mp_obj_type_t esp32_nvs_type = {
149151
.make_new = esp32_nvs_make_new,
150152
.locals_dict = (mp_obj_dict_t *)&esp32_nvs_locals_dict,
151153
};
154+
155+
#else // esp-idf v3
156+
157+
STATIC mp_obj_t esp32_nvs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
158+
mp_raise_ValueError(MP_ERROR_TEXT("NVS not supported with esp-idf v3"));
159+
return mp_const_none;
160+
}
161+
STATIC const mp_rom_map_elem_t esp32_nvs_locals_dict_table[] = { };
162+
STATIC MP_DEFINE_CONST_DICT(esp32_nvs_locals_dict, esp32_nvs_locals_dict_table);
163+
164+
165+
const mp_obj_type_t esp32_nvs_type = {
166+
{ &mp_type_type },
167+
.name = MP_QSTR_NVS,
168+
.make_new = esp32_nvs_make_new,
169+
.locals_dict = (mp_obj_dict_t *)&esp32_nvs_locals_dict,
170+
};
171+
172+
#endif

0 commit comments

Comments
 (0)
0