📄 d12setup.h
字号:
extern void Setup_control(void);
extern void Setup_read(void);
extern void USB_submit(void);
extern void get_status(void);
extern void clear_feature(void);
extern void set_feature(void);
extern void set_address(void);
extern void get_descriptor(void);
extern void set_descriptor(void);
extern void get_configuration(void);
extern void set_configuration(void);
extern void get_interface(void);
extern void set_interface(void);
extern void void_function(void);
void (*StandardDeviceRequest[])(void) =
{
&get_status,
&clear_feature,
&void_function,
&set_feature,
&void_function,
&set_address,
&get_descriptor,
&void_function,
&get_configuration,
&set_configuration,
&get_interface,
&set_interface,
&void_function
};
/** /
extern void set_DMA(void);
void (* VendorDeviceRequest[])(void)=
{
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&void_function,
&set_DMA,
&void_function,
&void_function,
&void_function
};
/**/
const char device_descriptor[] =
{
0x12, // 描述表大小 (18 bytes)
0x01, // 设备描述表类型
0x10, 0x01, // 兼容设备版本号(BCD码) 00 01
0xdc, // class code (each interface specifies class information) */ dc
0x00, // device sub-class (must be set to 0 because class code is 0) */00
0x00, // device protocol (no class specific protocol) */00
0x10, // 端点0最大包大小(8,16,32,64)
0x71, 0x04, // 厂商ID 71 04
0x90, 0x08, // 产品ID 90 08
0x00, 0x01, // 设备发行号(BCD码)
0x00, // 厂商信息字符串索引
0x00, // 产品信息字符串索引
0x00, // 设备序列号字符串索引(不支持设为0)
0x01 // 可能配置数
};
const char Configuration_Descriptor[] =
{
0x09, // 配置描述表长度
0x02, // 配置描述表类型
0x2e,0x00, // 配置描述表及附带表长度
0x01, // 接口配置数
0x01, // 配置描述表标识
0x00, // 配置描述表字符串描述表索引
0x20, // 配置属性
0x64 // 总线供电最大值(*2mA)
};
const char Interface_Descriptor[] =
{
0x09, // 接口描述表长度(9)
0x04, // 接口描述表类型
0x00, // 接口号(0)
0x00, // 轮寻设置(0 号端点)
0x04, // 端点数 (4)//4
0xdc, // 接口类属
0xa0, // 子类码
0xb0, // 协议码
0x00 // 接口字符串描述表索引(不支持)
};
const char Endpoint1_out_Descriptor[] =
{
0x07, // 端点描述表长度(7)
0x05, // 端点描述表类型
0x01, // OUT 端点(1)
0x03, // 传输模式(0 控制、1 同步、2 批、3 中断传输)
0x10, 0x00, // 最大包大小(16)
0x01 // 轮寻时间 (1ms)
};
const char Endpoint1_in_Descriptor[] =
{
0x07, // 端点描述表长度(7)
0x05, // 端点描述表类型
0x81, // IN 端点(1)
0x03, // 传输模式(0 控制、1 同步、2 批、3 中断传输)
0x10, 0x00, // 最大包大小(16)
0x01 // 轮寻时间 (1ms)
};
const char Endpoint2_out_Descriptor[] =
{
0x07, // 端点描述表长度(7)
0x05, // 端点描述表类型
0x02, // OUT 端点(2)
0x02, // 传输模式(0 控制、1 同步、2 批、3 中断传输)
0x40, 0x00, // 最大包大小(128)
0x01 // 轮寻时间 (1ms中断用)
};
const char Endpoint2_in_Descriptor[] =
{
0x07, // 端点描述表长度(7)
0x05, // 端点描述表类型
0x82, // IN 端点(2)
0x02, // 传输模式(0 控制、1 同步、2 批、3 中断传输)0x02
0x40, 0x00, // 最大包大小(64)40 00
0x01 // 轮寻时间 (1ms中断用)
};
/** /
const char USBStringLanguageDescription[] =
{
0x04,//sizeof(USBStringLanguageDescription), // 字符串描述表长度
0x03, // 字符串描述表类型
0x09, // 语言标识(9 英语)
0x04 // 子语言标识: Default
};
const char USBStringDescription1[] =
{
0x40,//sizeof(USBStringDescription1),
0x03,
'C',0,'y',0,'p',0,'r',0,'e',0,'s',0,'s',0,' '
};
const char USBStringDescription2[] =
{
sizeof(USBStringDescription2),
0x03,
'C',0,'y',0,'p',0,'r',0,'e',0,'s',0,'s',0,' '
};
/**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -