metronome/pico-cp/boot.py
Me Here b5584454b3 PM_K-1 CircuitPython: add boot.py to guarantee the USB-MIDI port appears
If the device isn't seen as a MIDI input (USB endpoint pressure from drive+serial+HID+MIDI),
boot.py disables the unused HID interface and enables usb_midi — copy it on and power-cycle.
Bundled into pm_k1_circuitpy.zip; documented in the README.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 22:57:23 -05:00

10 lines
426 B
Python

# boot.py — runs once before USB connects (hard reset / power-cycle to apply).
# Guarantees the device shows up as a USB-MIDI port so the web editor's "Device audio"
# can hear it. We don't use HID, so disabling it frees a USB endpoint for MIDI on the
# Pico (which also exposes the CIRCUITPY drive + serial at the same time).
import usb_hid, usb_midi
try:
usb_hid.disable()
except Exception:
pass
usb_midi.enable()