This commit is contained in:
hathach 2018-04-16 14:03:44 +07:00
parent 033c84033b
commit dd0d9e8014
5 changed files with 29 additions and 23 deletions

@ -1 +1 @@
Subproject commit b9b92dd27b0ab09c49c781ba65671beaa3eefdd8 Subproject commit 6f7c4346c39bd57014e95b577255c3870a5979c6

View File

@ -58,6 +58,7 @@
#include "pstorage.h" #include "pstorage.h"
#include "tusb.h" #include "tusb.h"
#include "tusb_descriptors.h"
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0] #define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
@ -360,6 +361,9 @@ int main(void)
// Init usb stack // Init usb stack
tusb_init(); tusb_init();
// Set usb descriptors
tud_set_descriptors(&usb_desc_init);
/*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/ /*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/
/* For metro52 LED_BLUE is muxed with FRESET. We only init FRESET BUTTON /* For metro52 LED_BLUE is muxed with FRESET. We only init FRESET BUTTON

View File

@ -46,26 +46,26 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// COMMON CONFIGURATION // COMMON CONFIGURATION
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_MCU OPT_MCU_NRF5X #define CFG_TUSB_MCU OPT_MCU_NRF5X
#define CFG_TUSB_CONTROLLER_0_MODE (OPT_MODE_DEVICE) #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_TUSB_OS OPT_OS_NONE
//#define CFG_TUD_TASK_PRIO 0 //#define CFG_TUD_TASK_PRIO 0
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// DEVICE CONFIGURATION // DEVICE CONFIGURATION
// Note: TUD Stand for Tiny Usb Device // Note: TUD Stand for Tiny Usb Device
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUD_ENDOINT0_SIZE 64 #define CFG_TUD_ENDOINT0_SIZE 64
//------------- Class enabled -------------// //------------- Class enabled -------------//
#define CFG_TUD_HID_KEYBOARD 0 #define CFG_TUD_HID_KEYBOARD 0
#define CFG_TUD_HID_MOUSE 0 #define CFG_TUD_HID_MOUSE 0
#define CFG_TUD_HID_GENERIC 0 // not supported yet #define CFG_TUD_HID_GENERIC 0 // not supported yet
#define CFG_TUD_MSC 0 #define CFG_TUD_MSC 0
#define CFG_TUD_CDC 1 #define CFG_TUD_CDC 1
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -73,17 +73,17 @@
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
// FIFO size of CDC TX and RX // 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 // 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 // USB RAM PLACEMENT
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_ATTR_USBRAM #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) \ #define BREAKPOINT_IGNORE_COUNT(n) \

View File

@ -288,12 +288,11 @@ uint16_t const * const string_descriptor_arr [] =
} }
}; };
//--------------------------------------------------------------------+
// TINYUSB Descriptors Pointer (this variable is required by the stack) /*------------- Variable used by tud_set_descriptors -------------*/
//--------------------------------------------------------------------+ tud_desc_init_t usb_desc_init =
tusbd_descriptor_pointer_t tusbd_descriptor_pointers =
{ {
.p_device = (uint8_t const * ) &desc_device, .device = (uint8_t const * ) &desc_device,
.p_configuration = (uint8_t const * ) &desc_configuration, .configuration = (uint8_t const * ) &desc_configuration,
.p_string_arr = (uint8_t const **) string_descriptor_arr, .string_arr = (uint8_t const **) string_descriptor_arr,
}; };

View File

@ -118,4 +118,7 @@ typedef struct ATTR_PACKED
} app_descriptor_configuration_t; } app_descriptor_configuration_t;
extern tud_desc_init_t usb_desc_init;
#endif #endif