Merge pull request #2805 from tannewt/update_tinyusb

Update tinyusb
This commit is contained in:
Scott Shawcroft 2020-04-26 20:55:36 -07:00 committed by GitHub
commit 9e4b94f466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 10 deletions

@ -1 +1 @@
Subproject commit 1f95f439e11f519e69d75a4a8b7b9f28eaf5060e
Subproject commit c59fa774274b13790a3ae0fc19d9651eeba560ab

View File

@ -28,6 +28,7 @@
#include "hpl/pm/hpl_pm_base.h"
#include "hpl/gclk/hpl_gclk_base.h"
#include "hal_gpio.h"
#include "lib/tinyusb/src/device/usbd.h"
void init_usb_hardware(void) {
#ifdef SAMD21
@ -57,3 +58,27 @@ void init_usb_hardware(void) {
gpio_set_pin_function(PIN_PA25, PINMUX_PA25H_USB_DP);
#endif
}
#ifdef SAMD21
void USB_Handler(void) {
tud_int_handler(0);
}
#endif
#ifdef SAMD51
void USB_0_Handler (void) {
tud_int_handler(0);
}
void USB_1_Handler (void) {
tud_int_handler(0);
}
void USB_2_Handler (void) {
tud_int_handler(0);
}
void USB_3_Handler (void) {
tud_int_handler(0);
}
#endif

View File

@ -27,6 +27,7 @@
#include <string.h>
#include "lib/tinyusb/src/device/usbd.h"
#include "py/mphal.h"
#include "py/mpstate.h"
#include "py/gc.h"
@ -36,10 +37,6 @@
#include "irq.h"
#ifdef CFG_TUSB_MCU
void hal_dcd_isr(uint8_t rhport);
#endif
/*------------------------------------------------------------------*/
/* delay
*------------------------------------------------------------------*/
@ -72,7 +69,7 @@ void isr(void) {
#ifdef CFG_TUSB_MCU
if (irqs & (1 << USB_INTERRUPT))
hal_dcd_isr(0);
tud_int_handler(0);
#endif
if (irqs & (1 << TIMER0_INTERRUPT))
SysTick_Handler();

View File

@ -56,5 +56,5 @@ void init_usb_hardware(void) {
}
void USB_OTG1_IRQHandler(void) {
tud_isr(0);
tud_int_handler(0);
}

View File

@ -30,6 +30,7 @@
#include "supervisor/usb.h"
#include "lib/utils/interrupt_char.h"
#include "lib/mp-readline/readline.h"
#include "lib/tinyusb/src/device/usbd.h"
#ifdef SOFTDEVICE_PRESENT
#include "nrf_sdm.h"
@ -87,3 +88,7 @@ void init_usb_hardware(void) {
}
}
}
void USBD_IRQHandler(void) {
tud_int_handler(0);
}

View File

@ -30,6 +30,7 @@
#include "supervisor/usb.h"
#include "lib/utils/interrupt_char.h"
#include "lib/mp-readline/readline.h"
#include "lib/tinyusb/src/device/usbd.h"
#include "py/mpconfig.h"
@ -63,13 +64,13 @@ STATIC void init_usb_vbus_sense(void) {
}
void init_usb_hardware(void) {
//TODO: if future chips overload this with options, move to peripherals management.
//TODO: if future chips overload this with options, move to peripherals management.
GPIO_InitTypeDef GPIO_InitStruct = {0};
/**USB_OTG_FS GPIO Configuration
PA10 ------> USB_OTG_FS_ID
PA11 ------> USB_OTG_FS_DM
PA12 ------> USB_OTG_FS_DP
PA12 ------> USB_OTG_FS_DP
*/
__HAL_RCC_GPIOA_CLK_ENABLE();
@ -129,3 +130,7 @@ void init_usb_hardware(void) {
init_usb_vbus_sense();
}
void OTG_FS_IRQHandler(void) {
tud_int_handler(0);
}

View File

@ -52,7 +52,7 @@ uint8_t const * tud_hid_descriptor_report_cb(void) {
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
uint16_t const* tud_descriptor_string_cb(uint8_t index) {
uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
uint8_t const max_index = sizeof(string_desc_arr)/sizeof(string_desc_arr[0]);
return (index < max_index) ? string_desc_arr[index] : NULL;
}