⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 descriptor.c

📁 AVR单片机C语言程序设计实例精粹
💻 C
字号:

#include <iom16v.h>
#include <macros.h>
#include "define.h"
#include "initial.h"
#include "pdiusbd12.h"
#include "descriptor.h"

#pragma data:code
const USB_DEVICE_DESCRIPTOR DeviceDescr=
{
	0x12,	//bLength
	0x01,  //device descriptor type
	0x00, 0x01, //bcdUSB0	//bcdUSB1
	0xDC,  //bDeviceClass
	0x00,	//bDeviceSubclass
	0x00,	//bDeviceProtocol
	0x10, //bMaxPacketSize(0)
	0x71,0x04, //idVendor
	0x66, 0x06,//idProduct0 //bcdDevice1
	0x00,0x01,//idProduct1	& bcdDevice0
	0x00, //iManufacturer
	0x00, //iProduct
	0x00, //iSerialNumber
	0x01, //bNumConfigurations
};

const USB_DESCRIPTOR usb_descr=
{
	{
		0x09, //usb configuration length
		0x02, //configuration Type
		0x2E,0x00, //wTotalLength
		0x01,  //bNumInterfaces
		1,    //configuration value
		0,   //string descriptor
		0x60, //bused power 
		0x32 
	},
	//interface descriptor
	{
		0x09, //interface descriptor length
		0x04, //descriptor Type
		0,   //just only one 
		0,  //one can configuration
		0x04, //there are 4 endpoint number exept controled
		0xDC, //
		0xA0,
		0xB0,
		0
	},
	//Endpoint descriptor
	//endp 1 In
	{
		0x07, //length
		0x05, //type 
		0x81, //endpoint 1 In
		0x03, //interrupt tr
		0x10, 0x00,//Max Enp0 packet size 
		10,   //Fram time	
	},
	//Endpoint 1 Out descriptor
	{
		0x07, //length
		0x05, //type
		0x01, //endpoint 1 Out
		0x03, //interrupt tr
		0x10,0x00, //packet size
		10,   //fram time 10ms
	},
	//Endpoint 2 In 
	{
		0x07, //length
		0x05, //type
		0x82, //Endpoint 2 In
		0x02, //Bulk Type
		0x40,0x00, //Max packet size
		10      //set stall 0x0A
	},
	//Endpoint 2 Out
	{
		0x07,  //length
		0x05, //type
		0x02, //endpoint 2 Out
		0x02, //Bulk Type
		0x40,0x00, //packet size
		10  //stall
	}

};
#pragma data:data

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -