diff options
| author | hathach <[email protected]> | 2019-05-12 14:09:35 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-05-12 14:09:35 +0700 |
| commit | ba2136486c153edd372eadaa325dab27fe1297b2 (patch) | |
| tree | d30de0dbfb87172da850733d88cf08ec9751e69e /examples/device/cdc_msc_hid/src | |
| parent | de56a0ca8987c15c06112ece2589dab18f1d6666 (diff) | |
add tud_hid_descriptor_report_cb()
- remove tud_desc_set.hid_report
- remove tud_desc_set_t
Diffstat (limited to 'examples/device/cdc_msc_hid/src')
| -rw-r--r-- | examples/device/cdc_msc_hid/src/usb_descriptors.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/examples/device/cdc_msc_hid/src/usb_descriptors.c b/examples/device/cdc_msc_hid/src/usb_descriptors.c index 6ddc11a82..bb830ca27 100644 --- a/examples/device/cdc_msc_hid/src/usb_descriptors.c +++ b/examples/device/cdc_msc_hid/src/usb_descriptors.c @@ -79,25 +79,34 @@ uint8_t const desc_hid_report[] = TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(REPORT_ID_KEYBOARD), ), TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(REPORT_ID_MOUSE), ) }; + +// Invoked when received GET HID REPORT DESCRIPTOR +// Application return pointer to descriptor +// Descriptor contents must exist long enough for transfer to complete +uint8_t const * tud_hid_descriptor_report_cb(void) +{ + return desc_hid_report; +} + #endif //------------- Configuration Descriptor -------------// enum { - #if CFG_TUD_CDC - ITF_NUM_CDC = 0, - ITF_NUM_CDC_DATA, - #endif +#if CFG_TUD_CDC + ITF_NUM_CDC = 0, + ITF_NUM_CDC_DATA, +#endif - #if CFG_TUD_MSC - ITF_NUM_MSC, - #endif +#if CFG_TUD_MSC + ITF_NUM_MSC, +#endif - #if CFG_TUD_HID - ITF_NUM_HID, - #endif +#if CFG_TUD_HID + ITF_NUM_HID, +#endif - ITF_NUM_TOTAL + ITF_NUM_TOTAL }; enum @@ -136,17 +145,20 @@ uint8_t const desc_configuration[] = #endif }; - -// tud_desc_set is required by tinyusb stack -tud_desc_set_t tud_desc_set = +// Invoked when received GET DEVICE DESCRIPTOR +// Application return pointer to descriptor +uint8_t const * tud_descriptor_device_cb(void) { - .device = &desc_device, - .config = desc_configuration, + return (uint8_t const *) &desc_device; +} -#if CFG_TUD_HID - .hid_report = desc_hid_report, -#endif -}; +// Invoked when received GET CONFIGURATION DESCRIPTOR +// Application return pointer to descriptor +// Descriptor contents must exist long enough for transfer to complete +uint8_t const * tud_descriptor_configuration_cb(void) +{ + return desc_configuration; +} //------------- String Descriptors -------------// |
