Skip to content

Commit 6e2c23b

Browse files
committed
Now to replace all the functions . .
1 parent d76739e commit 6e2c23b

File tree

13 files changed

+115
-491
lines changed

13 files changed

+115
-491
lines changed

esp32/Makefile

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ESPTOOL ?= $(ESPCOMP)/esptool_py/esptool/esptool.py
3131
BADGE = $(IDF_PATH)/..
3232

3333
# verify the ESP IDF version
34-
ESPIDF_SUPHASH := 9b955f4c9f1b32652ea165d3e4cdaad01bba170e
34+
ESPIDF_SUPHASH := a3b3f4efbf2051bc1e5cbe906fb7b5695472967e
3535
ESPIDF_CURHASH := $(shell git -C $(ESPIDF) show -s --pretty=format:'%H')
3636
ifneq ($(ESPIDF_CURHASH),$(ESPIDF_SUPHASH))
3737
$(info ** WARNING **)
@@ -85,6 +85,10 @@ INC += -I$(ESPCOMP)/mbedtls/include
8585
INC += -I$(ESPCOMP)/mbedtls/port/include
8686
INC += -I$(ESPCOMP)/spi_flash/include
8787
INC += -I$(ESPCOMP)/vfs/include
88+
INC += -I$(ESPCOMP)/fatfs/src
89+
INC += -I$(ESPCOMP)/sdmmc/include
90+
INC += -I$(ESPCOMP)/wear_levelling/include
91+
INC += -I$(ESPCOMP)/wear_levelling/private_include
8892
INC += -I$(ESPCOMP)/newlib/platform_include
8993
INC += -I$(ESPCOMP)/xtensa-debug-module/include
9094
INC += -I$(ESPCOMP)/wpa_supplicant/include
@@ -126,7 +130,6 @@ SRC_C = \
126130
uart.c \
127131
gccollect.c \
128132
mphalport.c \
129-
fatfs_port.c \
130133
help.c \
131134
modutime.c \
132135
moduos.c \
@@ -144,7 +147,6 @@ SRC_C = \
144147
modbadge.c \
145148
modugfx.c \
146149
moduhashlib.c \
147-
espneopixel.c \
148150
machine_rtc.c \
149151
machine_hw_spi.c \
150152
mpthreadport.c \
@@ -197,12 +199,6 @@ LIB_SRC_C = $(addprefix lib/,\
197199
utils/sys_stdio_mphal.c \
198200
)
199201

200-
ifeq ($(MICROPY_FATFS), 1)
201-
LIB_SRC_C += \
202-
lib/oofatfs/ff.c \
203-
lib/oofatfs/option/unicode.c
204-
endif
205-
206202
DRIVERS_SRC_C = $(addprefix drivers/,\
207203
dht/dht.c \
208204
)
@@ -331,6 +327,26 @@ ESPIDF_VFS_O = $(addprefix $(ESPCOMP)/vfs/,\
331327
vfs.o \
332328
)
333329

330+
ESPIDF_FATFS_O = $(addprefix $(ESPCOMP)/fatfs/src/,\
331+
ff.o \
332+
vfs_fat.o \
333+
vfs_fat_spiflash.o \
334+
vfs_fat_sdmmc.o \
335+
diskio.o \
336+
diskio_spiflash.o \
337+
diskio_sdmmc.o \
338+
ffsystem.o \
339+
ffunicode.o \
340+
)
341+
342+
ESPIDF_WEAR_LEVELING_O = $(addprefix $(ESPCOMP)/wear_levelling/,\
343+
wear_levelling.o \
344+
WL_Flash.o \
345+
SPI_Flash.o \
346+
Partition.o \
347+
crc32.o \
348+
)
349+
334350
ESPIDF_JSON_O = $(addprefix $(ESPCOMP)/json/,\
335351
library/cJSON.o \
336352
port/cJSON_Utils.o \
@@ -578,6 +594,8 @@ OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_APP_TRACE_O))
578594
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_EXPAT_O))
579595
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_FREERTOS_O))
580596
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_VFS_O))
597+
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_FATFS_O))
598+
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_WEAR_LEVELING_O))
581599
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_JSON_O))
582600
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_LOG_O))
583601
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(ESPIDF_LWIP_O))

esp32/fatfs_port.c

Lines changed: 0 additions & 46 deletions
This file was deleted.

esp32/modesp.c

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -38,60 +38,60 @@
3838
#include "py/runtime.h"
3939
#include "rom/rtc.h"
4040

41-
STATIC mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t buf_in) {
42-
mp_int_t offset = mp_obj_get_int(offset_in);
43-
mp_buffer_info_t bufinfo;
44-
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE);
45-
esp_err_t res = spi_flash_read(offset, bufinfo.buf, bufinfo.len);
46-
if (res != ESP_OK) {
47-
mp_raise_OSError(MP_EIO);
48-
}
49-
return mp_const_none;
50-
}
51-
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read);
52-
53-
STATIC mp_obj_t esp_flash_write(mp_obj_t offset_in, mp_obj_t buf_in) {
54-
mp_int_t offset = mp_obj_get_int(offset_in);
55-
mp_buffer_info_t bufinfo;
56-
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
57-
esp_err_t res = spi_flash_write(offset, bufinfo.buf, bufinfo.len);
58-
if (res != ESP_OK) {
59-
mp_raise_OSError(MP_EIO);
60-
}
61-
return mp_const_none;
62-
}
63-
STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write);
64-
65-
STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
66-
mp_int_t sector = mp_obj_get_int(sector_in);
67-
esp_err_t res = spi_flash_erase_sector(sector);
68-
if (res != ESP_OK) {
69-
mp_raise_OSError(MP_EIO);
70-
}
71-
return mp_const_none;
72-
}
73-
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
74-
75-
STATIC mp_obj_t esp_flash_size(void) {
76-
return mp_obj_new_int_from_uint(spi_flash_get_chip_size());
77-
}
78-
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
79-
80-
STATIC mp_obj_t esp_flash_user_start(void) {
81-
return MP_OBJ_NEW_SMALL_INT(0x200000);
82-
}
83-
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj,
84-
esp_flash_user_start);
85-
86-
STATIC mp_obj_t esp_neopixel_write_(mp_obj_t pin, mp_obj_t buf,
87-
mp_obj_t timing) {
88-
mp_buffer_info_t bufinfo;
89-
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
90-
esp_neopixel_write(mp_hal_get_pin_obj(pin), (uint8_t *)bufinfo.buf,
91-
bufinfo.len, mp_obj_get_int(timing));
92-
return mp_const_none;
93-
}
94-
STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_neopixel_write_obj, esp_neopixel_write_);
41+
// STATIC mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t buf_in) {
42+
// mp_int_t offset = mp_obj_get_int(offset_in);
43+
// mp_buffer_info_t bufinfo;
44+
// mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE);
45+
// esp_err_t res = spi_flash_read(offset, bufinfo.buf, bufinfo.len);
46+
// if (res != ESP_OK) {
47+
// mp_raise_OSError(MP_EIO);
48+
// }
49+
// return mp_const_none;
50+
// }
51+
// STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read);
52+
//
53+
// STATIC mp_obj_t esp_flash_write(mp_obj_t offset_in, mp_obj_t buf_in) {
54+
// mp_int_t offset = mp_obj_get_int(offset_in);
55+
// mp_buffer_info_t bufinfo;
56+
// mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
57+
// esp_err_t res = spi_flash_write(offset, bufinfo.buf, bufinfo.len);
58+
// if (res != ESP_OK) {
59+
// mp_raise_OSError(MP_EIO);
60+
// }
61+
// return mp_const_none;
62+
// }
63+
// STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write);
64+
//
65+
// STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
66+
// mp_int_t sector = mp_obj_get_int(sector_in);
67+
// esp_err_t res = spi_flash_erase_sector(sector);
68+
// if (res != ESP_OK) {
69+
// mp_raise_OSError(MP_EIO);
70+
// }
71+
// return mp_const_none;
72+
// }
73+
// STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
74+
//
75+
// STATIC mp_obj_t esp_flash_size(void) {
76+
// return mp_obj_new_int_from_uint(spi_flash_get_chip_size());
77+
// }
78+
// STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
79+
//
80+
// STATIC mp_obj_t esp_flash_user_start(void) {
81+
// return MP_OBJ_NEW_SMALL_INT(0x200000);
82+
// }
83+
// STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj,
84+
// esp_flash_user_start);
85+
//
86+
// STATIC mp_obj_t esp_neopixel_write_(mp_obj_t pin, mp_obj_t buf,
87+
// mp_obj_t timing) {
88+
// mp_buffer_info_t bufinfo;
89+
// mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
90+
// esp_neopixel_write(mp_hal_get_pin_obj(pin), (uint8_t *)bufinfo.buf,
91+
// bufinfo.len, mp_obj_get_int(timing));
92+
// return mp_const_none;
93+
// }
94+
// STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_neopixel_write_obj, esp_neopixel_write_);
9595

9696
STATIC mp_obj_t esp_rtcmem_write_(mp_obj_t pos, mp_obj_t val) {
9797
esp_rtcmem_write(mp_obj_get_int(pos), mp_obj_get_int(val));
@@ -126,14 +126,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_start_sleeping_obj, esp_start_sleeping_);
126126
STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
127127
{MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp)},
128128

129-
{MP_ROM_QSTR(MP_QSTR_flash_read), MP_ROM_PTR(&esp_flash_read_obj)},
130-
{MP_ROM_QSTR(MP_QSTR_flash_write), MP_ROM_PTR(&esp_flash_write_obj)},
131-
{MP_ROM_QSTR(MP_QSTR_flash_erase), MP_ROM_PTR(&esp_flash_erase_obj)},
132-
{MP_ROM_QSTR(MP_QSTR_flash_size), MP_ROM_PTR(&esp_flash_size_obj)},
133-
{MP_ROM_QSTR(MP_QSTR_flash_user_start),
134-
MP_ROM_PTR(&esp_flash_user_start_obj)},
135-
136-
{MP_ROM_QSTR(MP_QSTR_neopixel_write), MP_ROM_PTR(&esp_neopixel_write_obj)},
129+
// {MP_ROM_QSTR(MP_QSTR_flash_read), MP_ROM_PTR(&esp_flash_read_obj)},
130+
// {MP_ROM_QSTR(MP_QSTR_flash_write), MP_ROM_PTR(&esp_flash_write_obj)},
131+
// {MP_ROM_QSTR(MP_QSTR_flash_erase), MP_ROM_PTR(&esp_flash_erase_obj)},
132+
// {MP_ROM_QSTR(MP_QSTR_flash_size), MP_ROM_PTR(&esp_flash_size_obj)},
133+
// {MP_ROM_QSTR(MP_QSTR_flash_user_start),
134+
// MP_ROM_PTR(&esp_flash_user_start_obj)},
135+
//
136+
// {MP_ROM_QSTR(MP_QSTR_neopixel_write), MP_ROM_PTR(&esp_neopixel_write_obj)},
137137

138138
{MP_ROM_QSTR(MP_QSTR_rtcmem_write), MP_ROM_PTR(&esp_rtcmem_write_obj)},
139139
{MP_ROM_QSTR(MP_QSTR_rtcmem_read), MP_ROM_PTR(&esp_rtcmem_read_obj)},

esp32/modules/_boot.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
import gc
2-
import uos
3-
from flashbdev import bdev
4-
5-
try:
6-
if bdev:
7-
uos.mount(bdev, '/')
8-
except OSError:
9-
import inisetup
10-
vfs = inisetup.setup()
11-
12-
gc.collect()
1+
# do we need anything here?

esp32/modules/boot.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import badge, machine, gc
2+
3+
if machine.reset_cause() != machine.DEEPSLEEP_RESET:
4+
badge.init()
5+
import launcher
6+
7+
gc.collect()

esp32/modules/flashbdev.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

esp32/modules/inisetup.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy