You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shared/tinyusb: Add per-driver runtime USB class control.
This change allows USB class drivers (CDC, MSC, NCM) to be individually
enabled/disabled at runtime without requiring TinyUSB submodule changes.
Key features:
- Classes are always compiled in but only enabled drivers appear in USB
descriptors
- When MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE disabled: all compiled
classes auto-enabled (backward compatibility)
- When MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE enabled: only CDC enabled
by default, others require explicit activation
- New Python API: usb.enable_cdc(), usb.enable_msc(), usb.enable_ncm()
- Dynamic descriptor generation based on enabled classes
- Proper cleanup of disabled drivers (e.g. NCM networking)
Usage:
usb = machine.USBDevice()
usb.active(False)
usb.enable_msc(True) # Enable mass storage
usb.enable_ncm(True) # Enable USB networking
usb.active(True)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: Andrew Leech <[email protected]>
0 commit comments