summaryrefslogtreecommitdiff
path: root/src/boot.py
blob: 0a30e17315592daaafa64dd46aca7542dab39526 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This example is for the MacroPad,
# or any board with buttons that are connected to ground when pressed.

import usb_cdc
import storage
import board, digitalio

# On the Macropad, pressing a key grounds it. You need to set a pull-up.
# If not pressed, the key will be at +V (due to the pull-up).
# The KEY12 is the RightBotom key in the keypad
button = digitalio.DigitalInOut(board.KEY12)
button.pull = digitalio.Pull.UP

usb_cdc.enable(console=True, data=True)
# Disable devices only if button is not pressed.
if button.value:
	print("KEY12 Unpressed, starting without storage")
	storage.disable_usb_drive()
else:
	print("Mounting USB storage")