Boot.py docs better example

This commit is contained in:
Kyle Brown 2022-10-01 18:22:56 -07:00 committed by xs5871
parent 711114ad30
commit 03c8a61ed0

View File

@ -38,18 +38,21 @@ import storage
import usb_cdc
import usb_hid
# This is from the base kmk boot.py
supervisor.set_next_stack_limit(4096 + 4096)
from kb import KMKKeyboard
from kmk.scanners import DiodeOrientation
# If this key is held during boot, don't run the code which hides the storage and disables serial
# To use another key just count its row and column and use those pins
# You can also use any other pins not already used in the matrix and make a button just for accesing your storage
col = digitalio.DigitalInOut(board.GP2)
row = digitalio.DigitalInOut(board.GP13)
# This will use the first row/col pin. Feel free to change it if you want it to be another pin
col = digitalio.DigitalInOut(KMKKeyboard.col_pins[0])
row = digitalio.DigitalInOut(KMKKeyboard.row_pins[0])
# TODO: If your diode orientation is ROW2COL, then make row the output and col the input
col.switch_to_output(value=True)
row.switch_to_input(pull=digitalio.Pull.DOWN)
if KMKKeyboard.diode_orientation == DiodeOrientation.COLUMNS:
col.switch_to_output(value=True)
row.switch_to_input(pull=digitalio.Pull.DOWN)
else:
col.switch_to_input(pull=digitalio.Pull.DOWN)
row.switch_to_output(value=True)
if not row.value:
storage.disable_usb_drive()