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 3737#include "irq.h"
3838
3939#ifdef CFG_TUSB_MCU
40- void hal_dcd_isr (uint8_t rhport );
4140#endif
4241
4342/*------------------------------------------------------------------*/
@@ -72,7 +71,7 @@ void isr(void) {
7271
7372#ifdef CFG_TUSB_MCU
7473 if (irqs & (1 << USB_INTERRUPT ))
75- hal_dcd_isr (0 );
74+ tud_int_handler (0 );
7675#endif
7776 if (irqs & (1 << TIMER0_INTERRUPT ))
7877 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 @@ -87,3 +87,7 @@ void init_usb_hardware(void) {
8787 }
8888 }
8989}
90+
91+ void USBD_IRQHandler (void ) {
92+ tud_int_handler (0 );
93+ }
Original file line number Diff line number Diff line change @@ -63,13 +63,13 @@ STATIC void init_usb_vbus_sense(void) {
6363}
6464
6565void init_usb_hardware (void ) {
66- //TODO: if future chips overload this with options, move to peripherals management.
66+ //TODO: if future chips overload this with options, move to peripherals management.
6767
6868 GPIO_InitTypeDef GPIO_InitStruct = {0 };
6969 /**USB_OTG_FS GPIO Configuration
7070 PA10 ------> USB_OTG_FS_ID
7171 PA11 ------> USB_OTG_FS_DM
72- PA12 ------> USB_OTG_FS_DP
72+ PA12 ------> USB_OTG_FS_DP
7373 */
7474 __HAL_RCC_GPIOA_CLK_ENABLE ();
7575
@@ -129,3 +129,7 @@ void init_usb_hardware(void) {
129129
130130 init_usb_vbus_sense ();
131131}
132+
133+ void OTG_FS_IRQHandler (void ) {
134+ tud_int_handler (0 );
135+ }
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