summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-08-18 08:44:10 -0400
committerDan Halbert <halbert@halwitz.org>2019-08-18 08:44:10 -0400
commite2a4c76a3745c512eb85ca5555ec35e5f7d52769 (patch)
tree0283335e2d5ee35acca75e0e1e89670494746a40 /py
parent85d7398476687a3abdbb142d79b8302ac43ef760 (diff)
make nrf touchio be generic: now available for SAMD51 too
Diffstat (limited to 'py')
-rw-r--r--py/circuitpy_defns.mk35
-rw-r--r--py/circuitpy_mpconfig.mk12
2 files changed, 32 insertions, 15 deletions
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index d4733e338..95939de2b 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -217,9 +217,8 @@ ifeq ($(CIRCUITPY_PEW),1)
SRC_PATTERNS += _pew/%
endif
-# All possible sources are listed here, and are filtered by SRC_PATTERNS.
-SRC_COMMON_HAL = \
-$(filter $(SRC_PATTERNS), \
+# All possible sources are listed here, and are filtered by SRC_PATTERNS in SRC_COMMON_HAL
+SRC_COMMON_HAL_ALL = \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
analogio/__init__.c \
@@ -272,10 +271,9 @@ $(filter $(SRC_PATTERNS), \
rtc/__init__.c \
supervisor/Runtime.c \
supervisor/__init__.c \
- time/__init__.c \
- touchio/TouchIn.c \
- touchio/__init__.c \
-)
+ time/__init__.c
+
+SRC_COMMON_HAL = $(filter $(SRC_PATTERNS), $(SRC_COMMON_HAL_ALL))
# These don't have corresponding files in each port but are still located in
# shared-bindings to make it clear what the contents of the modules are.
@@ -298,9 +296,7 @@ SRC_BINDINGS_ENUMS += \
help.c \
util.c
-# All possible sources are listed here, and are filtered by SRC_PATTERNS.
-SRC_SHARED_MODULE = \
-$(filter $(SRC_PATTERNS), \
+SRC_SHARED_MODULE_ALL = \
_pixelbuf/PixelBuf.c \
_pixelbuf/__init__.c \
_stage/Layer.c \
@@ -349,8 +345,23 @@ $(filter $(SRC_PATTERNS), \
uheap/__init__.c \
ustack/__init__.c \
_pew/__init__.c \
- _pew/PewPew.c \
-)
+ _pew/PewPew.c
+
+# All possible sources are listed here, and are filtered by SRC_PATTERNS.
+SRC_SHARED_MODULE = $(filter $(SRC_PATTERNS), $(SRC_SHARED_MODULE_ALL))
+
+# Use the native touchio if requested. This flag is set conditionally in, say, mpconfigport.h.
+# The presence of common-hal/touchio/* # does not imply it's available for all chips in a port,
+# so there is an explicit flag. For example, SAMD21 touchio is native, but SAMD51 is not.
+ifeq ($(CIRCUITPY_TOUCHIO_USE_NATIVE),1)
+SRC_COMMON_HAL_ALL += \
+ touchio/TouchIn.c \
+ touchio/__init__.c
+else
+SRC_SHARED_MODULE_ALL += \
+ touchio/TouchIn.c \
+ touchio/__init__.c
+endif
ifeq ($(INTERNAL_LIBM),1)
SRC_LIBM = \
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index a408cd7ac..7469fbf3f 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -45,10 +45,10 @@ endif
# Use for for early stage or highly restricted ports
ifndef CIRCUITPY_DEFAULT_BUILD
ifeq ($(CIRCUITPY_MINIMAL_BUILD),1)
- CIRCUITPY_FULL_BUILD = 0
- CIRCUITPY_DEFAULT_BUILD = 0
+ CIRCUITPY_FULL_BUILD = 0
+ CIRCUITPY_DEFAULT_BUILD = 0
else
- CIRCUITPY_DEFAULT_BUILD = 1
+ CIRCUITPY_DEFAULT_BUILD = 1
endif
endif
@@ -235,6 +235,12 @@ CIRCUITPY_TIME = $(CIRCUITPY_DEFAULT_BUILD)
endif
CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME)
+# touchio might be native or generic. See circuitpy_defns.mk.
+ifndef CIRCUITPY_TOUCHIO_USE_NATIVE
+CIRCUITPY_TOUCHIO_USE_NATIVE = 0
+endif
+CFLAGS += -DCIRCUITPY_TOUCHIO_USE_NATIVE=$(CIRCUITPY_TOUCHIO_USE_NATIVE)
+
ifndef CIRCUITPY_TOUCHIO
CIRCUITPY_TOUCHIO = $(CIRCUITPY_DEFAULT_BUILD)
endif