diff --git a/include/libopencm3/usb/usbstd.h b/include/libopencm3/usb/usbstd.h index ec5881ae..78abf247 100644 --- a/include/libopencm3/usb/usbstd.h +++ b/include/libopencm3/usb/usbstd.h @@ -153,6 +153,16 @@ struct usb_device_qualifier_descriptor { uint8_t bReserved; } __attribute__((packed)); +/* This is only defined as a top level named struct to improve c++ + * compatibility. You should never need to instance this struct + * in user code! */ +struct usb_interface { + uint8_t *cur_altsetting; + uint8_t num_altsetting; + const struct usb_iface_assoc_descriptor *iface_assoc; + const struct usb_interface_descriptor *altsetting; +}; + /* USB Standard Configuration Descriptor - Table 9-10 */ struct usb_config_descriptor { uint8_t bLength; @@ -165,12 +175,7 @@ struct usb_config_descriptor { uint8_t bMaxPower; /* Descriptor ends here. The following are used internally: */ - const struct usb_interface { - uint8_t *cur_altsetting; - uint8_t num_altsetting; - const struct usb_iface_assoc_descriptor *iface_assoc; - const struct usb_interface_descriptor *altsetting; - } *interface; + const struct usb_interface *interface; } __attribute__((packed)); #define USB_DT_CONFIGURATION_SIZE 9