summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-04-16 10:11:54 -0700
committerScott Shawcroft <scott@tannewt.org>2019-04-16 10:11:54 -0700
commit0e03a321e4c4fba6c5d700bfef830c6196aec106 (patch)
tree88e524829978a3874da8b0d5001558e3c6942b33 /py
parentc927e6b938ff35fe0f42180d1dc0f9d58f8e571c (diff)
Fully split gamepadshift from gamepad
Diffstat (limited to 'py')
-rw-r--r--py/circuitpy_defns.mk7
-rw-r--r--py/circuitpy_mpconfig.h12
2 files changed, 12 insertions, 7 deletions
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index be7ff0b11..1aca33901 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -131,10 +131,9 @@ SRC_PATTERNS += frequencyio/%
endif
ifeq ($(CIRCUITPY_GAMEPAD),1)
SRC_PATTERNS += gamepad/%
- # gamepadshift depends on gamepad
- ifeq ($(CIRCUITPY_GAMEPADSHIFT),1)
- SRC_PATTERNS += gamepadshift/%
- endif
+endif
+ifeq ($(CIRCUITPY_GAMEPADSHIFT),1)
+SRC_PATTERNS += gamepadshift/%
endif
ifeq ($(CIRCUITPY_I2CSLAVE),1)
SRC_PATTERNS += i2cslave/%
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index 3952b5e06..a101aa527 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -315,8 +315,6 @@ extern const struct _mp_obj_module_t frequencyio_module;
#if CIRCUITPY_GAMEPAD
extern const struct _mp_obj_module_t gamepad_module;
-// Scan gamepad every 32ms
-#define CIRCUITPY_GAMEPAD_TICKS 0x1f
#define GAMEPAD_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_gamepad),(mp_obj_t)&gamepad_module },
#else
#define GAMEPAD_MODULE
@@ -329,6 +327,14 @@ extern const struct _mp_obj_module_t gamepadshift_module;
#define GAMEPADSHIFT_MODULE
#endif
+#if CIRCUITPY_GAMEPAD || CIRCUITPY_GAMEPADSHIFT
+// Scan gamepad every 32ms
+#define CIRCUITPY_GAMEPAD_TICKS 0x1f
+#define GAMEPAD_ROOT_POINTERS mp_obj_t gamepad_singleton;
+#else
+#define GAMEPAD_ROOT_POINTERS
+#endif
+
#if CIRCUITPY_I2CSLAVE
extern const struct _mp_obj_module_t i2cslave_module;
#define I2CSLAVE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_i2cslave), (mp_obj_t)&i2cslave_module },
@@ -612,7 +618,7 @@ extern const struct _mp_obj_module_t ustack_module;
const char *readline_hist[8]; \
vstr_t *repl_line; \
mp_obj_t rtc_time_source; \
- mp_obj_t gamepad_singleton; \
+ GAMEPAD_ROOT_POINTERS \
mp_obj_t pew_singleton; \
mp_obj_t terminal_tilegrid_tiles; \
BOARD_I2C_ROOT_POINTER \