diff --git a/adafruit_clue.py b/adafruit_clue.py index c44f0dd..3a32eaf 100644 --- a/adafruit_clue.py +++ b/adafruit_clue.py @@ -53,7 +53,6 @@ import audiobusio import audiopwmio import audiocore -import gamepad import touchio __version__ = "0.0.0-auto.0" @@ -197,7 +196,6 @@ def __init__(self): self._a.switch_to_input(pull=digitalio.Pull.UP) self._b = digitalio.DigitalInOut(board.BUTTON_B) self._b.switch_to_input(pull=digitalio.Pull.UP) - self._gamepad = gamepad.GamePad(self._a, self._b) # Define LEDs: self._white_leds = digitalio.DigitalInOut(board.WHITE_LEDS) @@ -350,29 +348,6 @@ def button_b(self): """ return not self._b.value - @property - def were_pressed(self): - """Returns a set of the buttons that have been pressed. - - .. image :: ../docs/_static/button_b.jpg - :alt: Button B - - To use with the CLUE: - - .. code-block:: python - - from adafruit_clue import clue - - while True: - print(clue.were_pressed) - """ - ret = set() - pressed = self._gamepad.get_pressed() - for button, mask in (("A", 0x01), ("B", 0x02)): - if mask & pressed: - ret.add(button) - return ret - def shake(self, shake_threshold=30, avg_count=10, total_delay=0.1): """ Detect when the accelerometer is shaken. Optional parameters: diff --git a/examples/advanced_examples/clue_ams_remote_advanced.py b/examples/advanced_examples/clue_ams_remote_advanced.py index a1a5b05..da2f727 100644 --- a/examples/advanced_examples/clue_ams_remote_advanced.py +++ b/examples/advanced_examples/clue_ams_remote_advanced.py @@ -136,20 +136,18 @@ time.sleep(0.25) # If button B (on the right) is pressed, it increases the volume - if "B" in clue.were_pressed: + if clue.button_b: ams.volume_up() - a = clue.were_pressed time.sleep(0.35) - while "B" in clue.were_pressed: + while clue.button_b: ams.volume_up() time.sleep(0.07) # If button A (on the left) is pressed, the volume decreases - if "A" in clue.were_pressed: + if clue.button_a: ams.volume_down() - a = clue.were_pressed time.sleep(0.35) - while "A" in clue.were_pressed: + while clue.button_a: ams.volume_down() time.sleep(0.07) time.sleep(0.01) diff --git a/examples/clue_ams_remote.py b/examples/clue_ams_remote.py index bda2a63..34aeb3f 100644 --- a/examples/clue_ams_remote.py +++ b/examples/clue_ams_remote.py @@ -62,18 +62,18 @@ time.sleep(0.25) # If button B (on the right) is pressed, it increases the volume - if "B" in clue.were_pressed: + if clue.button_b: ams.volume_up() time.sleep(0.30) - while "B" in clue.were_pressed: + while clue.button_b: ams.volume_up() time.sleep(0.07) # If button A (on the left) is pressed, the volume decreases - if "A" in clue.were_pressed: + if clue.button_a: ams.volume_down() time.sleep(0.30) - while "A" in clue.were_pressed: + while clue.button_a: ams.volume_down() time.sleep(0.07)