Skip to content

Commit

Permalink
Made TestConsole button pin assignable
Browse files Browse the repository at this point in the history
  • Loading branch information
fasteddy516 committed Aug 20, 2021
1 parent c2f51c4 commit 37b3110
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions joystick_xl/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import time

import board # type: ignore (this is a CircuitPython built-in)
import digitalio # type: ignore (this is a CircuitPython built-in)
from supervisor import runtime # type: ignore (this is a CircuitPython built-in)
# These are all CircuitPython built-ins
import board # type: ignore
import digitalio # type: ignore
from microcontroller import Pin # type: ignore
from supervisor import runtime # type: ignore

from joystick_xl import __version__
from joystick_xl.inputs import Axis, Hat
Expand Down Expand Up @@ -98,11 +100,11 @@ def TestHats(js: Joystick, pace: float = 0.25, quiet: bool = False) -> None:
print("DONE")


def TestConsole():
def TestConsole(button_pin: Pin = board.D2):
"""Run JoystickXL's REPL-based, built-in test console."""
INVALID_OPERATION = "> Invalid operation."

button = digitalio.DigitalInOut(board.D2)
button = digitalio.DigitalInOut(button_pin)
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.UP

Expand Down

0 comments on commit 37b3110

Please sign in to comment.