/********************************** (C) COPYRIGHT *******************************
* File Name          : usb_desc.c
* Author             : WCH
* Version            : V1.0.0
* Date               : 2021/08/08
* Description        : Descriptors for Virtual Com Port Demo.
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/ 
#include "usb_lib.h"
#include "usb_desc.h"

/* USB Device Descriptors */
const uint8_t  USBD_DeviceDescriptor[] = { 
    0x12, USB_DEVICE_DESCRIPTOR_TYPE, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08,
    0x86, 0x1a, 0xff, 0xfe,
    0x00, 0x01, 0x01, 0x02, 0x00, 0x01
};

/* USB Configration Descriptors */
const uint8_t  USBD_ConfigDescriptor[] = { 
	0x09,0x02,0x3b,0x00,0x02,0x01,0x00,0xA0,0x32,                    /* Configration Descriptor */

    0x09,0x04,0x00,0x00,0x01,0x03,0x01,0x01,0x00,                    /* Interface Descriptor */
    0x09,0x21,0x11,0x01,0x00,0x01,0x22,sizeof(USBD_KeyRepDesc)&0xFF,sizeof(USBD_KeyRepDesc)>>8,/* HID Class Descriptor */
    0x07,0x05,0x81,0x03,ENDP1_IN_SIZE,0x00,0x0a,                       /* Endpoint Descriptor */

    0x09,0x04,0x01,0x00,0x01,0x03,0x01,0x02,0x00,                    /* Interface Descriptor */
    0x09,0x21,0x10,0x01,0x00,0x01,0x22,sizeof(USBD_MouseRepDesc)&0xFF,sizeof(USBD_MouseRepDesc)>>8,/* HID Class Descriptor */
    0x07,0x05,0x82,0x03,ENDP2_IN_SIZE,0x00,0x0a                        /* Endpoint Descriptor */
};

/* USB String Descriptors */
const uint8_t USBD_StringLangID[USBD_SIZE_STRING_LANGID] = {
	USBD_SIZE_STRING_LANGID,
	USB_STRING_DESCRIPTOR_TYPE,
	0x09,
	0x04 
};

/* USB Device String Vendor */
const uint8_t USBD_StringVendor[USBD_SIZE_STRING_VENDOR] = {
	USBD_SIZE_STRING_VENDOR,    
	USB_STRING_DESCRIPTOR_TYPE,           
	'W', 0, 'C', 0, 'H', 0, 
};

/* USB Device String Product */
const uint8_t USBD_StringProduct[USBD_SIZE_STRING_PRODUCT] = {
	USBD_SIZE_STRING_PRODUCT,         
	USB_STRING_DESCRIPTOR_TYPE,        
	'C', 0, 'H', 0, '3', 0, '2', 0, ' ', 0, 'K', 0, 'e', 0,
	'y', 0, 'b', 0, 'o', 0, 'a', 0, 'r', 0, 'd', 0, '&', 0, 'M', 0,
	'o', 0, 'u', 0, 's', 0, 'e', 0,
};

/* USB Device String Serial */
uint8_t USBD_StringSerial[USBD_SIZE_STRING_SERIAL] = {
	USBD_SIZE_STRING_SERIAL,          
	USB_STRING_DESCRIPTOR_TYPE,                   
	'W', 0, 'C', 0, 'H', 0, '3', 0, '2', 0
};

/* HID Report Descriptor */
const uint8_t USBD_KeyRepDesc[] =
{
    0x05,0x01,0x09,0x06,0xA1,0x01,0x05,0x07,
    0x19,0xe0,0x29,0xe7,0x15,0x00,0x25,0x01,
    0x75,0x01,0x95,0x08,0x81,0x02,0x95,0x01,
    0x75,0x08,0x81,0x01,0x95,0x03,0x75,0x01,
    0x05,0x08,0x19,0x01,0x29,0x03,0x91,0x02,
    0x95,0x05,0x75,0x01,0x91,0x01,0x95,0x06,
    0x75,0x08,0x26,0xff,0x00,0x05,0x07,0x19,
    0x00,0x29,0x91,0x81,0x00,0xC0
};
const uint8_t USBD_MouseRepDesc[] =
{
    0x05,0x01,0x09,0x02,0xA1,0x01,0x09,0x01,
    0xA1,0x00,0x05,0x09,0x19,0x01,0x29,0x03,
    0x15,0x00,0x25,0x01,0x75,0x01,0x95,0x03,
    0x81,0x02,0x75,0x05,0x95,0x01,0x81,0x01,
    0x05,0x01,0x09,0x30,0x09,0x31,0x09,0x38,
    0x15,0x81,0x25,0x7f,0x75,0x08,0x95,0x03,
    0x81,0x06,0xC0,0xC0
};





