diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-04-17 10:22:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-17 10:22:24 -0400 |
| commit | 6684a3c72370772f0ab503d3410005ab7fd9d450 (patch) | |
| tree | dd3fae8e55043de564d14e206154ae13fed4b49d /ports | |
| parent | 608bf5076b7cd1564a634d7341f1444698907170 (diff) | |
| parent | 2fa1bf4351dc93c76635482f94ab72beef1bfaf1 (diff) | |
Merge pull request #1778 from pewpew-game/gamepad-shift
Add GamePadShift for handling shift-register-based buttons
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk | 2 | ||||
| -rw-r--r-- | ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 2 | ||||
| -rw-r--r-- | ports/atmel-samd/supervisor/port.c | 6 | ||||
| -rw-r--r-- | ports/atmel-samd/tick.c | 13 |
4 files changed, 22 insertions, 1 deletions
diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk index 2c1d9c717..620a0d505 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk @@ -20,6 +20,8 @@ CHIP_FAMILY = samd21 CFLAGS_INLINE_LIMIT = 50 +CIRCUITPY_GAMEPAD = 0 + # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index 837e2e514..a2ab9ed00 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -14,6 +14,8 @@ CIRCUITPY_AUDIOBUSIO = 0 # No touch on SAMD51 yet CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_GAMEPADSHIFT = 1 + CHIP_VARIANT = SAMD51J19A CHIP_FAMILY = samd51 diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index f8d830d8b..4f53d30f9 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -71,6 +71,9 @@ #if CIRCUITPY_GAMEPAD #include "shared-module/gamepad/__init__.h" #endif +#if CIRCUITPY_GAMEPADSHIFT +#include "shared-module/gamepadshift/__init__.h" +#endif #include "shared-module/_pew/PewPew.h" extern volatile bool mp_msc_enabled; @@ -229,6 +232,9 @@ void reset_port(void) { #if CIRCUITPY_GAMEPAD gamepad_reset(); #endif +#if CIRCUITPY_GAMEPADSHIFT + gamepadshift_reset(); +#endif #if CIRCUITPY_PEW pew_reset(); #endif diff --git a/ports/atmel-samd/tick.c b/ports/atmel-samd/tick.c index 149347793..dde473375 100644 --- a/ports/atmel-samd/tick.c +++ b/ports/atmel-samd/tick.c @@ -29,10 +29,16 @@ #include "peripheral_clk_config.h" #include "supervisor/shared/autoreload.h" -#include "shared-module/gamepad/__init__.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Processor.h" +#if CIRCUITPY_GAMEPAD +#include "shared-module/gamepad/__init__.h" +#endif + +#if CIRCUITPY_GAMEPADSHIFT +#include "shared-module/gamepadshift/__init__.h" +#endif // Global millisecond tick count volatile uint64_t ticks_ms = 0; @@ -51,7 +57,12 @@ void SysTick_Handler(void) { #endif #ifdef CIRCUITPY_GAMEPAD_TICKS if (!(ticks_ms & CIRCUITPY_GAMEPAD_TICKS)) { + #if CIRCUITPY_GAMEPAD gamepad_tick(); + #endif + #if CIRCUITPY_GAMEPADSHIFT + gamepadshift_tick(); + #endif } #endif } |
