| 
 | 1 | +/*  | 
 | 2 | + * Shared USB for the Raspberry Pi Pico RP2040  | 
 | 3 | + * Allows for multiple endpoints to share the USB controller  | 
 | 4 | + *  | 
 | 5 | + * Copyright (c) 2021 Earle F. Philhower, III <[email protected]>  | 
 | 6 | + *  | 
 | 7 | + * This library is free software; you can redistribute it and/or  | 
 | 8 | + * modify it under the terms of the GNU Lesser General Public  | 
 | 9 | + * License as published by the Free Software Foundation; either  | 
 | 10 | + * version 2.1 of the License, or (at your option) any later version.  | 
 | 11 | + *  | 
 | 12 | + * This library is distributed in the hope that it will be useful,  | 
 | 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
 | 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  | 
 | 15 | + * Lesser General Public License for more details.  | 
 | 16 | + *  | 
 | 17 | + * You should have received a copy of the GNU Lesser General Public  | 
 | 18 | + * License along with this library; if not, write to the Free Software  | 
 | 19 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  | 
 | 20 | + */  | 
 | 21 | + | 
 | 22 | +#include "pico/mutex.h"  | 
 | 23 | + | 
 | 24 | +// Weak function definitions for each type of endpoint  | 
 | 25 | +extern void __USBInstallSerial() __attribute__((weak));  | 
 | 26 | +extern void __USBInstallKeyboard() __attribute__((weak));  | 
 | 27 | +extern void __USBInstallMouse() __attribute__((weak));  | 
 | 28 | +extern void __USBInstallMIDI() __attribute__((weak));  | 
 | 29 | + | 
 | 30 | +// Big, global USB mutex, shared with all USB devices to make sure we don't  | 
 | 31 | +// have multiple cores updating the TUSB state in parallel  | 
 | 32 | +extern mutex_t __usb_mutex;  | 
 | 33 | + | 
 | 34 | +// HID report ID inquiry (report ID will vary depending on the number/type of other HID)  | 
 | 35 | +int __USBGetKeyboardReportID();  | 
 | 36 | +int __USBGetMouseReportID();  | 
 | 37 | + | 
 | 38 | +// Called by main() to init the USB HW/SW.  | 
 | 39 | +void __USBStart();  | 
0 commit comments