📄 5509ausb.txt
字号:
Uint16 Request;
USB_REQUEST_RET ReqHandlerRet = USB_REQUEST_DONE;
USB_EVENT_MASK USB_ctl_events;
USB_ctl_events = (USB_getEvents(hEp0Out) | USB_getEvents(hEp0In));
//Match with the appropriate EVENT
if(USB_ctl_events & USB_EVENT_RESET) // USB RESET event received
{
USB_abortAllTransaction(DevNum); // stop all data transfer activities
usbCurConfigStat = 0x00; // reset device config number
usbCurAltSetStat = 0x00; // reset Alt Setting number
USB_init(USB0, myUsbConfig, 0x80); // reconfig the USB module
}
if(USB_ctl_events & USB_EVENT_SUSPEND) //USB suspend
{
//add code here to deal with suspend
}
if((USB_ctl_events & USB_EVENT_SETUP) == USB_EVENT_SETUP)
{
if(USB_getSetupPacket(DevNum,&USB_Setup) == USB_FALSE)
{
//stall the control pipe
ReqHandlerRet = USB_REQUEST_STALL;
}
//decode the setup packet
else
{
// unpacket the setup packet
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -