Skip to content

Commit 71d74c8

Browse files
authored
Merge pull request #89 from nitz/add-peripheral-button-boot0
Adds `BOOT0` as a fifth pin for the `Peripherals.buttons` list.
2 parents 5a5de05 + 600b51f commit 71d74c8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

adafruit_magtag/peripherals.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,14 @@ def __init__(self) -> None:
6464
self._light = AnalogIn(board.LIGHT)
6565

6666
# Buttons
67+
button_pins = [board.BUTTON_A, board.BUTTON_B, board.BUTTON_C, board.BUTTON_D]
68+
69+
# Add BOOT0 as a button pin, only if it's defined.
70+
if hasattr(board, "BOOT0"):
71+
button_pins.append(board.BOOT0)
72+
6773
self.buttons = []
68-
for pin in (board.BUTTON_A, board.BUTTON_B, board.BUTTON_C, board.BUTTON_D):
74+
for pin in button_pins:
6975
switch = DigitalInOut(pin)
7076
switch.direction = Direction.INPUT
7177
switch.pull = Pull.UP

0 commit comments

Comments
 (0)