本文整理汇总了C++中USBDevice_SAMD21G18x::epBank0AckSetupReceived方法的典型用法代码示例。如果您正苦于以下问题:C++ USBDevice_SAMD21G18x::epBank0AckSetupReceived方法的具体用法?C++ USBDevice_SAMD21G18x::epBank0AckSetupReceived怎么用?C++ USBDevice_SAMD21G18x::epBank0AckSetupReceived使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USBDevice_SAMD21G18x
的用法示例。
在下文中一共展示了USBDevice_SAMD21G18x::epBank0AckSetupReceived方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ISRHandler
void USBDeviceClass::ISRHandler()
{
if (_pack_message == true) {
return;
}
// End-Of-Reset
if (usbd.isEndOfResetInterrupt())
{
// Configure EP 0
initEP(0, USB_ENDPOINT_TYPE_CONTROL);
// Enable Setup-Received interrupt
usbd.epBank0EnableSetupReceived(0);
_usbConfiguration = 0;
usbd.ackEndOfResetInterrupt();
}
// Start-Of-Frame
if (usbd.isStartOfFrameInterrupt())
{
usbd.ackStartOfFrameInterrupt();
}
// Endpoint 0 Received Setup interrupt
if (usbd.epBank0IsSetupReceived(0))
{
usbd.epBank0AckSetupReceived(0);
USBSetup *setup = reinterpret_cast<USBSetup *>(udd_ep_out_cache_buffer[0]);
/* Clear the Bank 0 ready flag on Control OUT */
// The RAM Buffer is empty: we can receive data
usbd.epBank0ResetReady(0);
bool ok;
if (REQUEST_STANDARD == (setup->bmRequestType & REQUEST_TYPE)) {
// Standard Requests
ok = handleStandardSetup(*setup);
} else {
// Class Interface Requests
ok = handleClassInterfaceSetup(*setup);
}
if (ok) {
usbd.epBank1SetReady(0);
} else {
stall(0);
}
if (usbd.epBank1IsStalled(0))
{
usbd.epBank1AckStalled(0);
// Remove stall request
usbd.epBank1DisableStalled(0);
}
} // end Received Setup handler
uint8_t i=0;
uint8_t ept_int = usbd.epInterruptSummary() & 0xFE; // Remove endpoint number 0 (setup)
while (ept_int != 0)
{
// Check if endpoint has a pending interrupt
if ((ept_int & (1 << i)) != 0)
{
// Endpoint Transfer Complete (0/1) Interrupt
if (usbd.epBank0IsTransferComplete(i) ||
usbd.epBank1IsTransferComplete(i))
{
handleEndpoint(i);
}
ept_int &= ~(1 << i);
}
i++;
if (i > USB_EPT_NUM)
break; // fire exit
}
}