File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed
ports/raspberrypi/supervisor Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,8 @@ STATIC void _usb_irq_wrapper(void) {
3939}
4040
4141void post_usb_init (void ) {
42- irq_set_enabled (USBCTRL_IRQ , false);
43-
44- irq_handler_t usb_handler = irq_get_exclusive_handler (USBCTRL_IRQ );
45- if (usb_handler ) {
46- irq_remove_handler (USBCTRL_IRQ , usb_handler );
47- }
48- irq_set_exclusive_handler (USBCTRL_IRQ , _usb_irq_wrapper );
49-
50- irq_set_enabled (USBCTRL_IRQ , true);
42+ irq_add_shared_handler (USBCTRL_IRQ , _usb_irq_wrapper ,
43+ PICO_SHARED_IRQ_HANDLER_LOWEST_ORDER_PRIORITY );
5144
5245 // There is a small window where the USB interrupt may be handled by the
5346 // pico-sdk instead of CircuitPython. If that is the case, then we'll have
Original file line number Diff line number Diff line change @@ -225,13 +225,17 @@ void usb_background_schedule(void) {
225225}
226226
227227void usb_irq_handler (int instance ) {
228+ #if CFG_TUSB_MCU != OPT_MCU_RP2040
229+ // For rp2040, IRQ handler is already installed and invoked automatically
228230 if (instance == CIRCUITPY_USB_DEVICE_INSTANCE ) {
229231 tud_int_handler (instance );
230- } else if (instance == CIRCUITPY_USB_HOST_INSTANCE ) {
231- #if CIRCUITPY_USB_HOST
232+ }
233+ #if CIRCUITPY_USB_HOST
234+ else if (instance == CIRCUITPY_USB_HOST_INSTANCE ) {
232235 tuh_int_handler (instance );
233- #endif
234236 }
237+ #endif
238+ #endif
235239
236240 usb_background_schedule ();
237241}
You can’t perform that action at this time.
0 commit comments