diff --git a/.gitmodules b/.gitmodules index b1b342927..07b2995ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,3 +52,6 @@ [submodule "FreeRTOS-Kernel"] path = FreeRTOS-Kernel url = https://github.com/earlephilhower/FreeRTOS-Kernel.git +[submodule "libraries/MIDIUSB"] + path = libraries/MIDIUSB + url = https://github.com/earlephilhower/MIDIUSB.git diff --git a/cores/rp2040/SerialUSB.cpp b/cores/rp2040/SerialUSB.cpp index d420a2e4c..096da6bda 100644 --- a/cores/rp2040/SerialUSB.cpp +++ b/cores/rp2040/SerialUSB.cpp @@ -80,7 +80,6 @@ void SerialUSB::end() { _running = false; USB.connect(); } - } int SerialUSB::peek() { diff --git a/cores/rp2040/USB.cpp b/cores/rp2040/USB.cpp index 36326edf7..b0b627613 100644 --- a/cores/rp2040/USB.cpp +++ b/cores/rp2040/USB.cpp @@ -62,7 +62,6 @@ USBClass USB; uint8_t _picotool_itf_num; #endif - int usb_hid_poll_interval __attribute__((weak)) = 10; uint8_t USBClass::registerEndpointIn() { @@ -91,7 +90,7 @@ void USBClass::unregisterEndpointOut(int ep) { _endpointOut |= (1 << (ep - 0x80)); } -uint8_t USBClass::addEntry(Entry **head, int interfaces, void (*cb)(int itf, uint8_t *dst, int len, void *param), const void *param, size_t len, int ordering, uint32_t vidMask) { +uint8_t USBClass::addEntry(Entry **head, int interfaces, void (*cb)(int itf, uint8_t *dst, int len, void *param), const void *param, size_t len, int ordering, uint32_t pidMask) { static uint8_t id = 1; Entry *n = (Entry *)malloc(sizeof(Entry)); @@ -101,7 +100,7 @@ uint8_t USBClass::addEntry(Entry **head, int interfaces, void (*cb)(int itf, uin n->interfaces = interfaces; n->order = ordering; n->localid = id++; - n->mask = vidMask; + n->mask = pidMask; n->next = nullptr; // Go down list until we hit the end or an entry with ordering >= our level @@ -163,8 +162,8 @@ uint8_t USBClass::findInterfaceID(unsigned int localid) { } // Called by a HID device to register a report. Returns the *local* ID which must be mapped to the HID report ID -uint8_t USBClass::registerHIDDevice(const uint8_t *descriptor, size_t len, int ordering, uint32_t vidMask) { - return addEntry(&_hids, 0, nullptr, (const void *)descriptor, len, ordering, vidMask); +uint8_t USBClass::registerHIDDevice(const uint8_t *descriptor, size_t len, int ordering, uint32_t pidMask) { + return addEntry(&_hids, 0, nullptr, (const void *)descriptor, len, ordering, pidMask); } void USBClass::unregisterHIDDevice(unsigned int localid) { @@ -172,8 +171,8 @@ void USBClass::unregisterHIDDevice(unsigned int localid) { } // Called by an object at global init time to add a new interface (non-HID, like CDC or Picotool) -uint8_t USBClass::registerInterface(int interfaces, void (*cb)(int itf, uint8_t *dst, int len, void *), void *param, size_t len, int ordering, uint32_t vidMask) { - return addEntry(&_interfaces, interfaces, cb, param, len, ordering, vidMask); +uint8_t USBClass::registerInterface(int interfaces, void (*cb)(int itf, uint8_t *dst, int len, void *), void *param, size_t len, int ordering, uint32_t pidMask) { + return addEntry(&_interfaces, interfaces, cb, param, len, ordering, pidMask); } void USBClass::unregisterInterface(unsigned int localid) { diff --git a/cores/rp2040/USB.h b/cores/rp2040/USB.h index c8f05c4ab..3662c299c 100644 --- a/cores/rp2040/USB.h +++ b/cores/rp2040/USB.h @@ -31,15 +31,15 @@ class USBClass { USBClass() { } // Called by an object at global init time to register a HID device, returns a localID to be mapped using findHIDReportID - // vidMask is the bits in the VID that should be XOR'd when this device is present. + // pidMask is the bits in the PID that should be XOR'd when this device is present. // 0 means don't invert anything, OTW select a single bitmask 1<