summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-05-06 11:04:53 -0500
committerJeff Epler <jepler@gmail.com>2020-06-26 11:50:23 -0500
commit57fde2e07bb2ee4dcff342deed08e4e7799da799 (patch)
treee0c9f2ecccc45637a48db61e823485ad3460e9cf /py
parent12df4ce221b212c866f83c0ccf0233458fb421bd (diff)
sdcardio: implement new library for SD card I/O
Testing performed: That a card is successfully mounted on Pygamer with the built in SD card slot This module is enabled for most FULL_BUILD boards, but is disabled for samd21 ("M0"), litex, and pca10100 for various reasons.
Diffstat (limited to 'py')
-rw-r--r--py/circuitpy_defns.mk5
-rw-r--r--py/circuitpy_mpconfig.h8
-rw-r--r--py/circuitpy_mpconfig.mk3
3 files changed, 16 insertions, 0 deletions
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index 74d8f548d..f40f506c2 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -213,6 +213,9 @@ endif
ifeq ($(CIRCUITPY_SAMD),1)
SRC_PATTERNS += samd/%
endif
+ifeq ($(CIRCUITPY_SDCARDIO),1)
+SRC_PATTERNS += sdcardio/%
+endif
ifeq ($(CIRCUITPY_STAGE),1)
SRC_PATTERNS += _stage/%
endif
@@ -384,6 +387,8 @@ SRC_SHARED_MODULE_ALL = \
fontio/__init__.c \
framebufferio/FramebufferDisplay.c \
framebufferio/__init__.c \
+ sdcardio/SDCard.c \
+ sdcardio/__init__.c \
gamepad/GamePad.c \
gamepad/__init__.c \
gamepadshift/GamePadShift.c \
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index c92cb1b66..10f91167b 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -537,6 +537,13 @@ extern const struct _mp_obj_module_t samd_module;
#define SAMD_MODULE
#endif
+#if CIRCUITPY_SDCARDIO
+extern const struct _mp_obj_module_t sdcardio_module;
+#define SDCARDIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sdcardio), (mp_obj_t)&sdcardio_module },
+#else
+#define SDCARDIO_MODULE
+#endif
+
#if CIRCUITPY_STAGE
extern const struct _mp_obj_module_t stage_module;
#define STAGE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module },
@@ -709,6 +716,7 @@ extern const struct _mp_obj_module_t watchdog_module;
ROTARYIO_MODULE \
RTC_MODULE \
SAMD_MODULE \
+ SDCARDIO_MODULE \
STAGE_MODULE \
STORAGE_MODULE \
STRUCT_MODULE \
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index 3459bff6d..0850c195a 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -166,6 +166,9 @@ CFLAGS += -DCIRCUITPY_RTC=$(CIRCUITPY_RTC)
CIRCUITPY_SAMD ?= 0
CFLAGS += -DCIRCUITPY_SAMD=$(CIRCUITPY_SAMD)
+CIRCUITPY_SDCARDIO ?= $(CIRCUITPY_FULL_BUILD)
+CFLAGS += -DCIRCUITPY_SDCARDIO=$(CIRCUITPY_SDCARDIO)
+
# Currently always off.
CIRCUITPY_STAGE ?= 0
CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE)