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/cdc_msc_hid/src | |
| parent | 164b26ee6bb0a24924e9736178808b676288845e (diff) | |
clean up usb descriptors in example
Diffstat (limited to 'examples/device/cdc_msc_hid/src')
| -rw-r--r-- | examples/device/cdc_msc_hid/src/usb_descriptors.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/examples/device/cdc_msc_hid/src/usb_descriptors.c b/examples/device/cdc_msc_hid/src/usb_descriptors.c index 1692151a0..b06658c56 100644 --- a/examples/device/cdc_msc_hid/src/usb_descriptors.c +++ b/examples/device/cdc_msc_hid/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), @@ -66,7 +68,17 @@ tusb_desc_device_t const desc_device = .bNumConfigurations = 0x01 }; -//------------- HID Report 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; +} + +//--------------------------------------------------------------------+ +// HID Report Descriptor +//--------------------------------------------------------------------+ + #if CFG_TUD_HID enum { @@ -90,7 +102,10 @@ uint8_t const * tud_hid_descriptor_report_cb(void) #endif -//------------- Configuration Descriptor -------------// +//--------------------------------------------------------------------+ +// Configuration Descriptor +//--------------------------------------------------------------------+ + enum { #if CFG_TUD_CDC @@ -145,12 +160,6 @@ uint8_t const desc_configuration[] = #endif }; -// 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 @@ -160,7 +169,10 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index) (void) index; // for multiple configurations return desc_configuration; } -//------------- String Descriptors -------------// + +//--------------------------------------------------------------------+ +// String Descriptors +//--------------------------------------------------------------------+ // array of pointer to string descriptors char const* string_desc_arr [] = |
