File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828#include "hpl/pm/hpl_pm_base.h"
2929#include "hpl/gclk/hpl_gclk_base.h"
3030#include "hal_gpio.h"
31+ #include "lib/tinyusb/src/device/usbd.h"
3132
3233void init_usb_hardware (void ) {
3334 #ifdef SAMD21
@@ -57,3 +58,27 @@ void init_usb_hardware(void) {
5758 gpio_set_pin_function (PIN_PA25 , PINMUX_PA25H_USB_DP );
5859 #endif
5960}
61+
62+ #ifdef SAMD21
63+ void USB_Handler (void ) {
64+ tud_int_handler (0 );
65+ }
66+ #endif
67+
68+ #ifdef SAMD51
69+ void USB_0_Handler (void ) {
70+ tud_int_handler (0 );
71+ }
72+
73+ void USB_1_Handler (void ) {
74+ tud_int_handler (0 );
75+ }
76+
77+ void USB_2_Handler (void ) {
78+ tud_int_handler (0 );
79+ }
80+
81+ void USB_3_Handler (void ) {
82+ tud_int_handler (0 );
83+ }
84+ #endif
Original file line number Diff line number Diff line change 2727
2828#include <string.h>
2929
30+ #include "lib/tinyusb/src/device/usbd.h"
3031#include "py/mphal.h"
3132#include "py/mpstate.h"
3233#include "py/gc.h"
3637
3738#include "irq.h"
3839
39- #ifdef CFG_TUSB_MCU
40- void hal_dcd_isr (uint8_t rhport );
41- #endif
42-
4340/*------------------------------------------------------------------*/
4441/* delay
4542 *------------------------------------------------------------------*/
@@ -72,7 +69,7 @@ void isr(void) {
7269
7370#ifdef CFG_TUSB_MCU
7471 if (irqs & (1 << USB_INTERRUPT ))
75- hal_dcd_isr (0 );
72+ tud_int_handler (0 );
7673#endif
7774 if (irqs & (1 << TIMER0_INTERRUPT ))
7875 SysTick_Handler ();
Original file line number Diff line number Diff line change @@ -56,5 +56,5 @@ void init_usb_hardware(void) {
5656}
5757
5858void USB_OTG1_IRQHandler (void ) {
59- tud_isr (0 );
59+ tud_int_handler (0 );
6060}
Original file line number Diff line number Diff line change 3030#include "supervisor/usb.h"
3131#include "lib/utils/interrupt_char.h"
3232#include "lib/mp-readline/readline.h"
33+ #include "lib/tinyusb/src/device/usbd.h"
3334
3435#ifdef SOFTDEVICE_PRESENT
3536#include "nrf_sdm.h"
@@ -87,3 +88,7 @@ void init_usb_hardware(void) {
8788 }
8889 }
8990}
91+
92+ void USBD_IRQHandler (void ) {
93+ tud_int_handler (0 );
94+ }
Original file line number Diff line number Diff line change 3030#include "supervisor/usb.h"
3131#include "lib/utils/interrupt_char.h"
3232#include "lib/mp-readline/readline.h"
33+ #include "lib/tinyusb/src/device/usbd.h"
3334
3435#include "py/mpconfig.h"
3536
@@ -63,13 +64,13 @@ STATIC void init_usb_vbus_sense(void) {
6364}
6465
6566void init_usb_hardware (void ) {
66- //TODO: if future chips overload this with options, move to peripherals management.
67+ //TODO: if future chips overload this with options, move to peripherals management.
6768
6869 GPIO_InitTypeDef GPIO_InitStruct = {0 };
6970 /**USB_OTG_FS GPIO Configuration
7071 PA10 ------> USB_OTG_FS_ID
7172 PA11 ------> USB_OTG_FS_DM
72- PA12 ------> USB_OTG_FS_DP
73+ PA12 ------> USB_OTG_FS_DP
7374 */
7475 __HAL_RCC_GPIOA_CLK_ENABLE ();
7576
@@ -129,3 +130,7 @@ void init_usb_hardware(void) {
129130
130131 init_usb_vbus_sense ();
131132}
133+
134+ void OTG_FS_IRQHandler (void ) {
135+ tud_int_handler (0 );
136+ }
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ uint8_t const * tud_hid_descriptor_report_cb(void) {
5252
5353// Invoked when received GET STRING DESCRIPTOR request
5454// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
55- uint16_t const * tud_descriptor_string_cb (uint8_t index ) {
55+ uint16_t const * tud_descriptor_string_cb (uint8_t index , uint16_t langid ) {
5656 uint8_t const max_index = sizeof (string_desc_arr )/sizeof (string_desc_arr [0 ]);
5757 return (index < max_index ) ? string_desc_arr [index ] : NULL ;
5858}
You can’t perform that action at this time.
0 commit comments