您的位置:首页 > 其它

STM32 USB工程的文件分析

2016-11-08 16:11 204 查看
先介绍下我参考其他工程而建立的STM32 USB工程:

             


简单介绍下:Startup当然放置STM32的启动文件,CMSIS放置着STM32内核ARMCortex的内核文件,StdPeripheral_Driver目录里放置着STM32外设的库函数,这几个都是STM32工程必须的,这里不仔细讲诉,User Source里放着自己的应用代码,如main.c,stm32f10x_it.c等文件都放这里。USB-FS-Driver_Driver下放着USB的库,这里暂时不讲述,我重点想分析的文件在USB-User里,这个目录主要放着一些与USB库和用户相关的文件,起着USB库与用户之间的桥梁作用,文件如下图所示,该目录包含如下文件:
      


   接下去要分别分析下这几个文件:

hw_config.c:

这个文件主要是配置一些跟板载及系统相关的代码,比如说USB系统时钟配置,上拉电阻引脚及LED灯配置,还有USB的中断灯。主要的函数如下:
<pre class="prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; position: relative; overflow-y: hidden; overflow-x: auto; color: rgb(78, 78, 78); font-size: 16px; line-height: 28px; padding: 2px; border: 1px solid rgb(136, 136, 136); background-color: rgb(255, 255, 255);"><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Set_System</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">            </span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置系统时钟,</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">USB </span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">及</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">LED</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">引脚配置*/</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Set_USBClock</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">USB</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">的时钟频率</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> GPIO_AINConfig</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">GPIO</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">模拟输入(这里是空函数)</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Enter_LowPowerMode</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">进入低功耗模式(这里是空函数)</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif;
1c140
white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Leave_LowPowerMode</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">离开低功耗模式(这里是空函数)</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> USB_Interrupts_Config</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">USB</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">中断配置</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> USB_Cable_Config </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">FunctionalState</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">NewState</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">USB</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">连接断开选择,其实是控制上拉电阻引脚</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*void Joystick_Send(uint8_t Keys);*/</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">操作杆发送(没有用)</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="text-indent: 21pt; font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*uint8_t JoyState(void);</span></span><span style="text-indent: 21pt; font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);"> */</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="text-indent: 21pt; font-size: 14px; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="text-indent: 21pt; font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">操作杆状态(没有用到</span></span><span style="line-height: 21.9886px; text-indent: 21pt; font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">)</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Get_SerialNum</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">创建字符串描述符的序列号</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p>



usb_des.c:

这个文件主要是定义了USB的一些描述符:分别是:设备描述符、配置描述符集合(包括接口描述符,HID描述符,端点描述符)、HID报告描述符、语言ID描述符、厂家的字符串描述符、产品的字符串描述符、产品序列号的字符串描述符。
<pre class="prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; position: relative; overflow-y: hidden; overflow-x: auto; color: rgb(78, 78, 78); font-size: 16px; line-height: 28px; padding: 2px; border: 1px solid rgb(136, 136, 136); background-color: rgb(255, 255, 255);"><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_DeviceDescriptor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">CUSTOMHID_SIZ_DEVICE_DESC</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">];</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_ConfigDescriptor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">CUSTOMHID_SIZ_CONFIG_DESC</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">];</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_ReportDescriptor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">CUSTOMHID_SIZ_REPORT_DESC</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">];</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_StringLangID</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">CUSTOMHID_SIZ_STRING_LANGID</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">];</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_StringVendor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">CUSTOMHID_SIZ_STRING_VENDOR</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">];</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_StringProduct</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">CUSTOMHID_SIZ_STRING_PRODUCT</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">];</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_StringSerial</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">CUSTOMHID_SIZ_STRING_SERIAL</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">];</span></span></p>



usb_endp.c:

这个文件主要是定义了几个端点输入输出的回调函数,这里指定以了端点1输入输出回调及端点2输入回调函数,如下:
<pre class="prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; position: relative; overflow-y: hidden; overflow-x: auto; color: rgb(78, 78, 78); font-size: 16px; line-height: 28px; padding: 2px; border: 1px solid rgb(136, 136, 136); background-color: rgb(255, 255, 255);"><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> EP1_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">端点</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">1</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">输入回调函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> EP1_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">端点</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">1</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">输出回调函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> EP2_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">端点</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">2</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">输入回调函数</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p>



usb_Istr.c:

这个文件主要是每个端点对应的回调函数的注册;USB中断服务程序的处理,通过读取STM32 ISTR中断状态寄存器来判断是什么中断,并做相应的专断处理。
<pre class="prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; position: relative; overflow-y: hidden; overflow-x: auto; color: rgb(78, 78, 78); font-size: 16px; line-height: 28px; padding: 2px; border: 1px solid rgb(136, 136, 136); background-color: rgb(255, 255, 255);"><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(*</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">pEpInt_IN</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="lit" style="line-height: 24px; color: rgb(0, 102, 102);">7</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">])(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">)</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">=</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">端点输入回调函数注册</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">{</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP1_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP2_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP3_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP4_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP5_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP6_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP7_IN_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">};</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">      </span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(*</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">pEpInt_OUT</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="lit" style="line-height: 24px; color: rgb(0, 102, 102);">7</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">])(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">)</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">=</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体; text-indent: 28px;"><span class="com" style="line-height: 28px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">端点输出回调函数的注册</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; text-indent: 28px; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">{</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP1_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP2_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP3_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP4_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP5_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP6_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    EP7_OUT_Callback</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">};</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">  </span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> USB_Istr</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">)</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">;</span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">ISTR</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">事件中断服务程序</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p>



usb_propc:

这个文件主要是把之前定义的一些列描述符注册到USB库中,并且注册一些USB常用的处理函数如获取设备描述符等和一些标准请求函数,具体如下:
<pre class="prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; position: relative; overflow-y: hidden; overflow-x: auto; color: rgb(78, 78, 78); font-size: 16px; line-height: 28px; padding: 2px; border: 1px solid rgb(136, 136, 136); background-color: rgb(255, 255, 255);"><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">DEVICE_PROP </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Device_Property</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">=</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">	</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">注册一些</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">{</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_init</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">			</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">的初始化函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_Reset</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">			</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">的复位函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_Status_In</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">状态输入函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_Status_Out</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">状态输出函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_Data_Setup</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">的处理带数据的特殊类请求函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_NoData_Setup</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">的处理不带数据特殊类请求函数</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_Get_Interface_Setting</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">	</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">获取接口及备用接口设置是否可用  </span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_GetDeviceDescriptor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">	</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">获取设备描述符</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_GetConfigDescriptor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">	</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">获取配置描述符</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_GetStringDescriptor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">	</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">CustomHID</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">获取字符串描述符</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="lit" style="line-height: 24px; color: rgb(0, 102, 102);">0</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">					</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">当前库未使用</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="lit" style="line-height: 24px; color: rgb(0, 102, 102);">0x40</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*MAX PACKET SIZE*/</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">	</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">最大的包长度为</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">64</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">字节</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">};</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">注册</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">USB</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">标准请求的实现函数</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">USER_STANDARD_REQUESTS </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">User_Standard_Requests</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">=</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">{</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_GetConfiguration</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">	</span></span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">	</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">获取配置请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_SetConfiguration</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置配置请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_GetInterface</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">获取接口请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_SetInterface</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置接口请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_GetStatus</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">获取状态请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_ClearFeature</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">清除特性请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_SetEndPointFeature</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">	</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置端点特性请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_SetDeviceFeature</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置设备特性请求</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">    </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_SetDeviceAddress</span><span style="line-height: 24px; white-space: pre;"><span class="pln" style="color: rgb(0, 0, 0);">		</span></span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">设置设备地址请求</span></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">};</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">注册设备描述符信息</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">ONE_DESCRIPTOR </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Device_Descriptor</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">;</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">注册报告描述符信息</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">ONE_DESCRIPTOR </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_Report_Descriptor</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">;</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">注册</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">HID</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">描述符信息</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">ONE_DESCRIPTOR </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">CustomHID_Descriptor</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">;</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">注册字符串描述符,包括语言</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">ID</span></span><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">、厂商、产品、序列号描述符</span><span style="font-family: "Times New Roman";"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">ONE_DESCRIPTOR </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">String_Descriptor</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">[</span><span class="lit" style="line-height: 24px; color: rgb(0, 102, 102);">4</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">]</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">;</span></span></p>



usb_pwr.c:

这个文件主要一些USB与功耗方面的函数,如上电、掉电、挂起等。
<pre class="prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; position: relative; overflow-y: hidden; overflow-x: auto; color: rgb(78, 78, 78); font-size: 16px; line-height: 28px; padding: 2px; border: 1px solid rgb(136, 136, 136); background-color: rgb(255, 255, 255);"><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Suspend</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">挂起</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Resume_Init</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">恢复初始化</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">Resume</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">RESUME_STATE eResumeSetVal</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">恢复到某个状态状态</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">RESULT </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">PowerOn</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">上电</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span><span style="line-height: 21.9886px; font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">*/</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">RESULT </span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">PowerOff</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="kwd" style="line-height: 24px; color: rgb(0, 0, 136);">void</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">);</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span></span><span style="font-family: 宋体; font-size: 14px;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">/*</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="com" style="line-height: 24px; color: rgb(136, 0, 0);">掉电*/</span></span></p>



usbio.c 

这个文件只有两个文件,一个是USB发送函数,另一个当然是USB接收函数。
<pre class="prettyprint" name="code" style="white-space: pre-wrap; word-wrap: break-word; position: relative; overflow-y: hidden; overflow-x: auto; color: rgb(78, 78, 78); font-size: 16px; line-height: 28px; padding: 2px; border: 1px solid rgb(136, 136, 136); background-color: rgb(255, 255, 255);"><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">uint32_t</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> USB_SendData</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">uint8_t</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">*</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">data</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">uint32_t</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> dataNum</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">)</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">;</span></span><span style="font-size: 10.5pt; font-family: 宋体;"></span></p><p style="margin-top: 0pt; margin-bottom: 0pt; padding-top: 0px; padding-bottom: 0px; line-height: 22px; font-family: Arial, Helvetica, sans-serif; white-space: normal; text-indent: 21pt;"><span style="font-size: 10.5pt; font-family: 宋体;"><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">uint32_t</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> USB_GetData</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">(</span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">uint8_t</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> </span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">*</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);">data</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">,</span><span class="typ" style="line-height: 24px; color: rgb(102, 0, 102);">uint32_t</span><span class="pln" style="line-height: 24px; color: rgb(0, 0, 0);"> dataNum</span><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">)</span></span><span style="font-size: 10.5pt; font-family: 宋体;"><span class="pun" style="line-height: 24px; color: rgb(102, 102, 0);">;</span></span></p>


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: