diff --git a/atusb/fw/usb/dfu.c b/atusb/fw/usb/dfu.c index 6efd9fd..a70c52b 100644 --- a/atusb/fw/usb/dfu.c +++ b/atusb/fw/usb/dfu.c @@ -77,15 +77,7 @@ const uint8_t config_descriptor[] = { /* Interface #0 */ - 9, /* bLength */ - USB_DT_INTERFACE, /* bDescriptorType */ - 0, /* bInterfaceNumber */ - 0, /* bAlternateSetting */ - 0, /* bNumEndpoints */ - 0xfe, /* bInterfaceClass (application specific) */ - 0x01, /* bInterfaceSubClass (device fw upgrade) */ - 0x02, /* bInterfaceProtocol (DFU mode protocol) */ - 0, /* iInterface */ + DFU_ITF_DESCR(0) }; diff --git a/atusb/fw/usb/dfu.h b/atusb/fw/usb/dfu.h index 152e297..0f2d262 100644 --- a/atusb/fw/usb/dfu.h +++ b/atusb/fw/usb/dfu.h @@ -78,6 +78,18 @@ struct dfu { }; +#define DFU_ITF_DESCR(itf) \ + 9, /* bLength */ \ + USB_DT_INTERFACE, /* bDescriptorType */ \ + (itf), /* bInterfaceNumber */ \ + 0, /* bAlternateSetting */ \ + 0, /* bNumEndpoints */ \ + 0xfe, /* bInterfaceClass (application specific) */ \ + 0x01, /* bInterfaceSubClass (device fw upgrade) */ \ + 0x02, /* bInterfaceProtocol (DFU mode protocol) */ \ + 0, /* iInterface */ + + extern struct dfu dfu;