Skip to content

Instantly share code, notes, and snippets.

@nraynaud
Created April 29, 2013 21:03
Show Gist options
  • Save nraynaud/5484759 to your computer and use it in GitHub Desktop.
Save nraynaud/5484759 to your computer and use it in GitHub Desktop.
const struct __attribute__((__packed__, aligned (4))) {
uint8_t bLength, bDescriptorType;
uint8_t bcdUSBL, bcdUSBH;
uint8_t bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize;
uint8_t idVendorL, idVendorH;
uint8_t idProductL, idProductH;
uint8_t bcdDeviceL, bcdDeviceH;
uint8_t iManufacturer, iProduct, iSerialNumber;
uint8_t bNumConfigurations;
} deviceDescriptor = {
.bLength = (uint8_t) sizeof(deviceDescriptor),
.bDescriptorType = USB_DEVICE_DESCRIPTOR_TYPE,
.bcdUSBL = 0x00,
.bcdUSBH = 0x02,
.bDeviceClass = 0x00,
.bDeviceSubClass = 0x00,
.bDeviceProtocol = 0x00,
.bMaxPacketSize = USB_OTG_MAX_EP0_SIZE,
.idVendorL = LOBYTE(USBD_VID),
.idVendorH = HIBYTE(USBD_VID),
.idProductL = LOBYTE(USBD_PID),
.idProductH = HIBYTE(USBD_PID),
.bcdDeviceL= 0x00,
.bcdDeviceH = 0x02,
.iManufacturer = USBD_IDX_MFC_STR,
.iProduct = USBD_IDX_PRODUCT_STR,
.iSerialNumber = USBD_IDX_SERIAL_STR,
.bNumConfigurations = USBD_CFG_MAX_NUM};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment