Skip to content

Instantly share code, notes, and snippets.

@Ch4ni
Last active October 10, 2023 00:04
Show Gist options
  • Save Ch4ni/542631e8b69affd4b94fed80d07646c6 to your computer and use it in GitHub Desktop.
Save Ch4ni/542631e8b69affd4b94fed80d07646c6 to your computer and use it in GitHub Desktop.
# Ada's boot.py for CRKBD, Left Hand Side on KMK w/ BoardSource Blok
# Just getting started:
# If key(0,0) is pressed, use the default boot mode. Otherwise
# boot without serial console or storage device.
import board
import storage
from kmk.bootcfg import bootcfg
# Allow writing to storage from CircuitPython
storage.remount("/", readonly=False)
# Set the volume name for our CRKBD left side
m = storage.getmount("/")
m.label = "CRKBDL"
# remount readonly in CircuitPython so that the computer
# can write to the drive (if enabled)
storage.remount("/", readonly=True)
# set "normal" boot to disable SerialUSB and Block Storage
if not bootcfg(
sense=board.GP29,
source=board.GP04,
storage=False,
cdc=False,
usb_id=("@foostan", "crkbd")
):
import supervisor
supervisor.runtime.autoreload = False
supervisor.set_usb_identification("@foostan", "crkbd-rw")
print( " Ch4ni - keypress detected! using default boot mode (storage=enabled, cdc=enabled)\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment