コード例 #1
0
#if defined(SINGLE_INTERFACE_WITH_ALTSETTINGS)
    /* Interface Descriptor */
    0x09,							// Size of this descriptor in bytes
    USB_DESCRIPTOR_INTERFACE,		// INTERFACE descriptor type
    INTF0_NUMBER,					// Interface Number
    0,								// Alternate Setting Number
    2,								// Number of endpoints in this intf
	0x00, 0x00, 0x00,			    // Class, Subclass, Protocol
    0,								// Interface string index
    
    0x07,									// Endpoint descriptor size
    USB_DESCRIPTOR_ENDPOINT,				// Endpoint descriptor
    USBGEN_EP_NUM_INTF0,					// Endpoint address
    USBGEN_EP_ATTRIBUTES_INTF0,				// Endpoint Attributes
    DESC_CONFIG_WORD(USBGEN_EP_SIZE_INTF0_ALT0),	// Endpoint Size
    USBGEN_EP_INTERVAL_INTF0,				// Endpoint Interval
    
    0x07,									// Endpoint descriptor size
    USB_DESCRIPTOR_ENDPOINT,				// Endpoint descriptor
    USBGEN_EP_NUM_INTF0|0x80,				// Endpoint address
    USBGEN_EP_ATTRIBUTES_INTF0,				// Endpoint Attributes
    DESC_CONFIG_WORD(USBGEN_EP_SIZE_INTF0_ALT0),	// Endpoint Size
    USBGEN_EP_INTERVAL_INTF0,				// Endpoint Interval

    /* Interface Descriptor */
    0x09,							// Size of this descriptor in bytes
    USB_DESCRIPTOR_INTERFACE,		// INTERFACE descriptor type
    INTF0_NUMBER,					// Interface Number
    1,								// Alternate Setting Number
    2,								// Number of endpoints in this intf
コード例 #2
0
ファイル: usb_descriptors.c プロジェクト: Athuli7/Microchip
    USB_EP0_BUFF_SIZE,          // Max packet size for EP0, see usb_config.h
    MY_VID,                 // Vendor ID
    MY_PID,                 // Product ID: Keyboard fw demo
    0x0001,                 // Device release number in BCD format
    0x01,                   // Manufacturer string index
    0x02,                   // Product string index
    0x00,                   // Device serial number string index
    0x01                    // Number of possible configurations
};

/* Configuration 1 Descriptor */
ROM BYTE configDescriptor1[]={
    /* Configuration Descriptor */
    0x09,//sizeof(USB_CFG_DSC),    // Size of this descriptor in bytes
    USB_DESCRIPTOR_CONFIGURATION,                // CONFIGURATION descriptor type
    DESC_CONFIG_WORD(0x0029),   // Total length of data for this cfg
    1,                      // Number of interfaces in this cfg
    1,                      // Index value of this configuration
    0,                      // Configuration string index
    _DEFAULT | _SELF | _RWU,               // Attributes, see usb_device.h
    50,                     // Max power consumption (2X mA)

    /* Interface Descriptor */
    0x09,//sizeof(USB_INTF_DSC),   // Size of this descriptor in bytes
    USB_DESCRIPTOR_INTERFACE,               // INTERFACE descriptor type
    0,                      // Interface Number
    0,                      // Alternate Setting Number
    2,                      // Number of endpoints in this intf
    HID_INTF,               // Class code
    BOOT_INTF_SUBCLASS,     // Subclass code
    HID_PROTOCOL_KEYBOARD,     // Protocol code
コード例 #3
0
ファイル: usb_descriptors.c プロジェクト: Athuli7/Microchip
    USB_EP0_BUFF_SIZE,      // Max packet size for EP0, see usb_config.h
    MY_VID,                 // Vendor ID
    MY_PID,                 // Product ID
    0x0001,                 // Device release number in BCD format
    0x01,                   // Manufacturer string index
    0x02,                   // Product string index
    0x00,                   // Device serial number string index
    0x01                    // Number of possible configurations
};

/* Configuration 1 Descriptor */
ROM BYTE configDescriptor1[]={
    /* Configuration Descriptor */
    0x09,//sizeof(USB_CFG_DSC),    // Size of this descriptor in bytes
    USB_DESCRIPTOR_CONFIGURATION,  // CONFIGURATION descriptor type
    DESC_CONFIG_WORD(0x0022),   // Total length of data for this cfg
    1,                      // Number of interfaces in this cfg
    1,                      // Index value of this configuration
    0,                      // Configuration string index
    _DEFAULT | _SELF | _RWU,// Attributes, see usb_device.h
    50,                     // Max power consumption (2X mA)

    /* Interface Descriptor */
    0x09,//sizeof(USB_INTF_DSC),   // Size of this descriptor in bytes
    USB_DESCRIPTOR_INTERFACE,      // INTERFACE descriptor type
    0,                      // Interface Number
    0,                      // Alternate Setting Number
    1,                      // Number of endpoints in this intf
    HID_INTF,               // Class code
    0,					    // Subclass code
    0,    // Protocol code