diff options
| author | hathach <[email protected]> | 2019-07-12 16:28:38 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-07-12 16:28:38 +0700 |
| commit | fdf39dd4aee82dc63d94a5a4e9423ecc15a268a1 (patch) | |
| tree | 4854288f736527bf12a876f08be5ba368b4904a8 /examples/device/midi_test | |
| parent | 164b26ee6bb0a24924e9736178808b676288845e (diff) | |
clean up usb descriptors in example
Diffstat (limited to 'examples/device/midi_test')
| -rw-r--r-- | examples/device/midi_test/src/usb_descriptors.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/examples/device/midi_test/src/usb_descriptors.c b/examples/device/midi_test/src/usb_descriptors.c index 21270745a..cffef0fb2 100644 --- a/examples/device/midi_test/src/usb_descriptors.c +++ b/examples/device/midi_test/src/usb_descriptors.c @@ -34,7 +34,9 @@ #define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) ) #define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | _PID_MAP(MIDI, 3) ) -//------------- Device Descriptors -------------// +//--------------------------------------------------------------------+ +// Device Descriptors +//--------------------------------------------------------------------+ tusb_desc_device_t const desc_device = { .bLength = sizeof(tusb_desc_device_t), @@ -56,7 +58,18 @@ tusb_desc_device_t const desc_device = .bNumConfigurations = 0x01 }; -//------------- Configuration Descriptor -------------// +// Invoked when received GET DEVICE DESCRIPTOR +// Application return pointer to descriptor +uint8_t const * tud_descriptor_device_cb(void) +{ + return (uint8_t const *) &desc_device; +} + + +//--------------------------------------------------------------------+ +// Configuration Descriptor +//--------------------------------------------------------------------+ + enum { ITF_NUM_MIDI = 0, @@ -83,13 +96,6 @@ uint8_t const desc_configuration[] = TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI, 0x80 | EPNUM_MIDI, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64) }; -// Invoked when received GET DEVICE DESCRIPTOR -// Application return pointer to descriptor -uint8_t const * tud_descriptor_device_cb(void) -{ - return (uint8_t const *) &desc_device; -} - // Invoked when received GET CONFIGURATION DESCRIPTOR // Application return pointer to descriptor // Descriptor contents must exist long enough for transfer to complete @@ -99,7 +105,9 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index) return desc_configuration; } -//------------- String Descriptors -------------// +//--------------------------------------------------------------------+ +// String Descriptors +//--------------------------------------------------------------------+ // array of pointer to string descriptors char const* string_desc_arr [] = |
