diff --git a/lib/tinyusb b/lib/tinyusb index b9b92dd..6f7c434 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit b9b92dd27b0ab09c49c781ba65671beaa3eefdd8 +Subproject commit 6f7c4346c39bd57014e95b577255c3870a5979c6 diff --git a/src/main.c b/src/main.c index 7e51a19..758c0dc 100644 --- a/src/main.c +++ b/src/main.c @@ -58,6 +58,7 @@ #include "pstorage.h" #include "tusb.h" +#include "tusb_descriptors.h" #define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0] @@ -360,6 +361,9 @@ int main(void) // Init usb stack tusb_init(); + // Set usb descriptors + tud_set_descriptors(&usb_desc_init); + /*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/ /* For metro52 LED_BLUE is muxed with FRESET. We only init FRESET BUTTON diff --git a/src/tusb_config.h b/src/tusb_config.h index c46410b..d049803 100644 --- a/src/tusb_config.h +++ b/src/tusb_config.h @@ -46,26 +46,26 @@ //--------------------------------------------------------------------+ // COMMON CONFIGURATION //--------------------------------------------------------------------+ -#define CFG_TUSB_MCU OPT_MCU_NRF5X -#define CFG_TUSB_CONTROLLER_0_MODE (OPT_MODE_DEVICE) +#define CFG_TUSB_MCU OPT_MCU_NRF5X +#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE -#define CFG_TUSB_DEBUG 2 +#define CFG_TUSB_DEBUG 2 -#define CFG_TUSB_OS OPT_OS_NONE -//#define CFG_TUD_TASK_PRIO 0 +#define CFG_TUSB_OS OPT_OS_NONE +//#define CFG_TUD_TASK_PRIO 0 //--------------------------------------------------------------------+ // DEVICE CONFIGURATION // Note: TUD Stand for Tiny Usb Device //--------------------------------------------------------------------+ -#define CFG_TUD_ENDOINT0_SIZE 64 +#define CFG_TUD_ENDOINT0_SIZE 64 //------------- Class enabled -------------// -#define CFG_TUD_HID_KEYBOARD 0 -#define CFG_TUD_HID_MOUSE 0 -#define CFG_TUD_HID_GENERIC 0 // not supported yet -#define CFG_TUD_MSC 0 -#define CFG_TUD_CDC 1 +#define CFG_TUD_HID_KEYBOARD 0 +#define CFG_TUD_HID_MOUSE 0 +#define CFG_TUD_HID_GENERIC 0 // not supported yet +#define CFG_TUD_MSC 0 +#define CFG_TUD_CDC 1 /*------------------------------------------------------------------*/ @@ -73,17 +73,17 @@ *------------------------------------------------------------------*/ // FIFO size of CDC TX and RX -#define CFG_TUD_CDC_BUFSIZE 1024 +#define CFG_TUD_CDC_BUFSIZE 1024 -// TX is sent automatically in Start of Frame event. +// TX is sent automatically every Start of Frame event. // If not enabled, application must call tud_cdc_flush() periodically -#define CFG_TUD_CDC_FLUSH_ON_SOF 1 +#define CFG_TUD_CDC_FLUSH_ON_SOF 1 //--------------------------------------------------------------------+ // USB RAM PLACEMENT //--------------------------------------------------------------------+ #define CFG_TUSB_ATTR_USBRAM -#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4) +#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4) #define BREAKPOINT_IGNORE_COUNT(n) \ diff --git a/src/tusb_descriptors.c b/src/tusb_descriptors.c index 18f22d6..04a1f16 100644 --- a/src/tusb_descriptors.c +++ b/src/tusb_descriptors.c @@ -288,12 +288,11 @@ uint16_t const * const string_descriptor_arr [] = } }; -//--------------------------------------------------------------------+ -// TINYUSB Descriptors Pointer (this variable is required by the stack) -//--------------------------------------------------------------------+ -tusbd_descriptor_pointer_t tusbd_descriptor_pointers = + +/*------------- Variable used by tud_set_descriptors -------------*/ +tud_desc_init_t usb_desc_init = { - .p_device = (uint8_t const * ) &desc_device, - .p_configuration = (uint8_t const * ) &desc_configuration, - .p_string_arr = (uint8_t const **) string_descriptor_arr, + .device = (uint8_t const * ) &desc_device, + .configuration = (uint8_t const * ) &desc_configuration, + .string_arr = (uint8_t const **) string_descriptor_arr, }; diff --git a/src/tusb_descriptors.h b/src/tusb_descriptors.h index 7359ec9..00aeee1 100644 --- a/src/tusb_descriptors.h +++ b/src/tusb_descriptors.h @@ -118,4 +118,7 @@ typedef struct ATTR_PACKED } app_descriptor_configuration_t; + +extern tud_desc_init_t usb_desc_init; + #endif