class documentation
USB HID Consumer Control device for media key input.
Builds a composite USB descriptor by appending a HID Consumer Control interface to the existing CDC configuration so both the REPL serial port and the media keys are available at the same time.
| Method | __init__ |
Create a USBMedia instance. |
| Method | init |
Initialise and activate the composite CDC + HID Consumer Control device. |
| Method | press |
Send a Consumer Control key press and immediately release it. |
| Constant | HID |
Undocumented |
| Constant | HID |
Undocumented |
| Constant | USAGE |
Undocumented |
| Constant | USAGE |
Undocumented |
| Constant | USAGE |
Undocumented |
| Constant | USAGE |
Undocumented |
| Constant | USAGE |
Undocumented |
| Constant | USAGE |
Undocumented |
| Constant | USAGE |
Undocumented |
| Method | _on |
Control-transfer callback for HID class requests. |
| Method | _on |
Transfer-complete callback; unblocks _wait when EP 0x83 finishes. |
| Method | _wait |
Block until the previous HID transfer completes or the timeout expires. |
| Instance Variable | _manufacturer |
Undocumented |
| Instance Variable | _product |
Undocumented |
| Instance Variable | _serial |
Undocumented |
| Instance Variable | _usbdev |
Undocumented |
| Instance Variable | _xfer |
Undocumented |
Create a USBMedia instance.
| Parameters | |
manufacturer:str | Manufacturer string in the USB device descriptor. Defaults to "MicroPython". |
product:str | Product string in the USB device descriptor. Defaults to "Pico Media". |
serial:str | Serial number string in the USB device descriptor. Defaults to "000002". |
Initialise and activate the composite CDC + HID Consumer Control device.
Appends a HID Consumer Control interface to the built-in CDC descriptor, re-configures the USBDevice, and activates it. Must be called once before any key-sending methods are used.
Send a Consumer Control key press and immediately release it.
| Parameters | |
usage:int | HID Consumer Control usage ID (e.g. USAGE_PLAY_PAUSE). |
Control-transfer callback for HID class requests.
| Parameters | |
stage:int | Transfer stage (1 = SETUP, 3 = ACK). |
request:bytes | Raw 8-byte SETUP packet. |
| Returns | |
bytes, bool | Requested data, True to ACK with no data, or False to stall. |
Transfer-complete callback; unblocks _wait when EP 0x83 finishes.
| Parameters | |
ep:int | Endpoint address that completed the transfer. |
res:int | Result code from the USB stack. |
numint | Number of bytes transferred. |