#include "OB90A64U1.h"
#include "Timer32.h"
#include "USB.h"
#include "USBDEF.h"
#include "USBCOM.h"
#include "USBTable.h"
#include "stdint.h"




uint8_t g_UsbStringDscrBuff0[] = 
{
    USB_DSCR_LEN_STRING,
    USB_DSCR_TYPE_STRING,
    0x09,
    0x04,
};

uint8_t g_UsbStringDscrBuff1[] = 
{
    18,
    USB_DSCR_TYPE_STRING,
    'S',0x00,
    'y',0x00,
    'n',0x00,
    'c',0x00,
    'M',0x00,
    'O',0x00,
    'S',0x00,
    '\0',0x00,  // Increase USB compatibility
 };

uint8_t g_UsbStringDscrBuff2[] = 
{
    32,
    USB_DSCR_TYPE_STRING,
    'M',0x00,
    'S',0x00,
    'M',0x00,
    '9',0x00,
    '0',0x00, 
    '6',0x00,
    '6',0x00,
    'P',0x00,
    'r',0x00,
    'i',0x00,
    'n',0x00,
    't',0x00,
    'e',0x00,
    'r',0x00,
    '\0', 0x00,
};


uint8_t g_UsbStringDscrBuff3[] = 
{
    20,
    USB_DSCR_TYPE_STRING,
    '1',0x00,
    '0',0x00,
    '0',0x00,
    '0',0x00,
    '0',0x00,
    '0',0x00,
    '0',0x00,
    '0',0x00,
    '\0',0x00,  // Increase USB compatibility
 
};

USB_ENUM_ALL_DESCRIPTORS g_usb_all_dscr = 
{
    // Device Descriptor
    {
        USB_DSCR_LEN_DEVICE,        // cLength;
        USB_DSCR_TYPE_DEVICE,       // cDescriptorType;
        0x10,                       // cBcdUSBL;
        0x01,                       // cBcdUSBH;
        0x00,                       // cDeviceClass;
        0x00,                       // cDeviceSubclass;
        0x00,                       // cDeviceProtocol;
        0x08,                       // cMaxPacketSize0;
        0x43,                       // cIdVendorL;		
		  	0x28,                       // cIdVendorH;     
		  	0x00,                       // cIdProductL;
        0x10,                       // cIdProductH;
        0x00,                       // cBcdDeviceL;
        0x01,                       // cBcdDeviceH;
        0x01,                       // cIManufacturer;
        0x02,                       // cIProduct;
        0x03,                       // cISerialNumber;
        0x01,                       // cNumConfiguration;
    },

    // Configuration Descriptor
    {
        USB_DSCR_LEN_CONFIG,                // cLength;
        USB_DSCR_TYPE_CONFIG,               // cDescriptorType;
        (USB_DSCR_CONFIG_ALL_LEN % 256),    // cTotalLengthL;
        (USB_DSCR_CONFIG_ALL_LEN / 256),    // cTotalLengthH;
        0x01,                               // cNumInterface;
        0x01,                               // cConfigurationValue;
        0x00,                               // cConfiguration;
        0xA0,                               // cAttributes;
        0x32,                               // cMaxPower;
    },

    // Interface Descriptor
    {
        USB_DSCR_LEN_INTERFACE,         // cLength;
        USB_DSCR_TYPE_INTERFACE,        // cDescriptorType;
        0x00,                           // cInterfaceNumber;
        0X00,                           // cAlternateSetting;
        USB_DSCR_ENDPOINT_NUM,          // cNumEndpoints;
        0x07,                           // cInterfaceClass;
        0x01,                           // cInterfaceSubclass;
        0x02,                           // cInterfaceProtocol;
        0x04,                           // cInterface;
    },

    // Endpoint Descriptor (IN )
    {
        USB_DSCR_LEN_ENDPOINT,           // cLength;
        USB_DSCR_TYPE_ENDPOINT,          // cDescriptorType;
        0x80 | USB_DSCR_BULK_IN_ENDPOINT,// cEndpointAddress;
        0x02,						                 // cAttribute;
        0x40,                            // cMaxPacketSizeL;
        0x00,                            // cMaxPacketSizeH;
        0x01,                            // cInterval;
    },

    // Endpoint Descriptor (OUT)
    {
        USB_DSCR_LEN_ENDPOINT,            // cLength;
        USB_DSCR_TYPE_ENDPOINT,           // cDescriptorType;
        0x00 | USB_DSCR_BULK_OUT_ENDPOINT,// cEndpointAddress;
        0x02,						                  // cAttribute;
        0x40 ,                            // cMaxPacketSizeL;
        0x00,                             // cMaxPacketSizeH;
        0x01,                             // cInterval;
    },
    g_UsbStringDscrBuff0,
    g_UsbStringDscrBuff1,
    g_UsbStringDscrBuff2,
    g_UsbStringDscrBuff3,
};

