这篇教程C++ Endpoint_IsINReady函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Endpoint_IsINReady函数的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint_IsINReady函数的具体用法?C++ Endpoint_IsINReady怎么用?C++ Endpoint_IsINReady使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Endpoint_IsINReady函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Endpoint_Write_Control_Stream_LEuint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length){ uint8_t* DataStream = (uint8_t*)Buffer; bool LastPacketFull = false; if (Length > USB_ControlRequest.wLength) Length = USB_ControlRequest.wLength; while (Length && !(Endpoint_IsOUTReceived())) { while (!(Endpoint_IsINReady())); while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize)) { Endpoint_Write_Byte(*(DataStream++)); Length--; } LastPacketFull = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize); Endpoint_ClearIN(); } if (Endpoint_IsOUTReceived()) return ENDPOINT_RWCSTREAM_HostAborted; if (LastPacketFull) { while (!(Endpoint_IsINReady())); Endpoint_ClearIN(); } while (!(Endpoint_IsOUTReceived())); return ENDPOINT_RWCSTREAM_NoError;}
开发者ID:hanshuebner,项目名称:ayce1,代码行数:35,
示例2: PRNT_Device_ProcessControlRequestvoid PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo){ if (!(Endpoint_IsSETUPReceived())) return; if (USB_ControlRequest.wIndex != PRNTInterfaceInfo->Config.InterfaceNumber) return; switch (USB_ControlRequest.bRequest) { case PRNT_REQ_GetDeviceID: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) return; } uint16_t IEEEStringLen = strlen(PRNTInterfaceInfo->Config.IEEE1284String); Endpoint_Write_16_BE(IEEEStringLen); Endpoint_Write_Control_Stream_LE(PRNTInterfaceInfo->Config.IEEE1284String, IEEEStringLen); Endpoint_ClearStatusStage(); } break; case PRNT_REQ_GetPortStatus: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) return; } Endpoint_Write_8(PRNTInterfaceInfo->State.PortStatus); Endpoint_ClearStatusStage(); } break; case PRNT_REQ_SoftReset: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); PRNTInterfaceInfo->State.IsPrinterReset = true; EVENT_PRNT_Device_SoftReset(PRNTInterfaceInfo); } break; }}
开发者ID:40000ft,项目名称:lufa,代码行数:58,
示例3: opensize_t USBSerial::write(uint8_t c){ /* only try to send bytes if the high-level CDC connection itself is open (not just the pipe) - the OS should set lineState when the port is opened and clear lineState when the port is closed. bytes sent before the user opens the connection or after the connection is closed are lost - just like with a UART. */ // TODO - ZE - check behavior on different OSes and test what happens if an // open connection isn't broken cleanly (cable is yanked out, host dies // or locks up, or host virtual serial port hangs) if (LineState > 0) { Endpoint_SelectEndpoint(CDC_TX_EPADDR); if (!Endpoint_IsReadWriteAllowed()) { Endpoint_ClearIN(); while (!Endpoint_IsINReady() && USB_DeviceState == DEVICE_STATE_Configured) { USB_USBTask(); } } set_blink_LED(); Endpoint_Write_8(c); return 1; } else { setWriteError(); return 0; }}
开发者ID:Industruino,项目名称:boarddefinitions,代码行数:30,
示例4: usb_debugvoid usb_debug( char *msg ){ /* Device must be connected and configured for the task to run */ if (USB_DeviceState != DEVICE_STATE_Configured) return; Endpoint_SelectEndpoint(GENERIC_IN_EPADDR); /* Check to see if the host is ready to accept another packet */ if (Endpoint_IsINReady()) { /* Create a temporary buffer to hold the report to send to the host */ uint8_t GenericData[BUFFER_EPSIZE]; int len = strlen( msg ); GenericData[0] = len; GenericData[1] = 0x01; // debug msg for ( int c = 0; c < len; c++ ) GenericData[c + 2] = *msg++; /* Write Generic Report Data */ Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData), NULL); /* Finalize the stream transfer to send the last packet */ Endpoint_ClearIN(); } _delay_ms(200);}
开发者ID:12019,项目名称:mooltipass,代码行数:31,
示例5: usbGetTemperaturevoid usbGetTemperature(){ Endpoint_ClearSETUP();//ack setup packet u8 sendData = 0; measureTemperature(); while (sendData < 2) { while (!Endpoint_IsINReady()) { //wait until host is ready } u16 value = measureTemperature(); Endpoint_Write_8(value>>8); sendData++; Endpoint_Write_8(value & 0xff); sendData++; Endpoint_ClearIN(); } //while (!Endpoint_IsOUTReceived()) { //wait for host to send status } //Endpoint_ClearOUT();//send message //Endpoint_ClearStatusStage();//success :D}
开发者ID:Codingboy,项目名称:ucuni,代码行数:26,
示例6: RNDIS_Device_USBTaskvoid RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo){ if (USB_DeviceState != DEVICE_STATE_Configured) return; Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpoint.Address); if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.ResponseReady) { USB_Request_Header_t Notification = (USB_Request_Header_t) { .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), .bRequest = RNDIS_NOTIF_ResponseAvailable, .wValue = CPU_TO_LE16(0), .wIndex = CPU_TO_LE16(0), .wLength = CPU_TO_LE16(0), }; Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL); Endpoint_ClearIN(); RNDISInterfaceInfo->State.ResponseReady = false; }}
开发者ID:abcminiuser,项目名称:lufa,代码行数:25,
示例7: MS_Device_ProcessControlRequestvoid MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo){ if (!(Endpoint_IsSETUPReceived())) return; if (USB_ControlRequest.wIndex != MSInterfaceInfo->Config.InterfaceNumber) return; switch (USB_ControlRequest.bRequest) { case MS_REQ_MassStorageReset: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); MSInterfaceInfo->State.IsMassStoreReset = true; } break; case MS_REQ_GetMaxLUN: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); while (!(Endpoint_IsINReady())); Endpoint_Write_8(MSInterfaceInfo->Config.TotalLUNs - 1); Endpoint_ClearIN(); Endpoint_ClearStatusStage(); } break; }}
开发者ID:40000ft,项目名称:lufa,代码行数:33,
示例8: HID_Task/** Function to manage HID report generation and transmission to the host. */void HID_Task(void){ /* Device must be connected and configured for the task to run */ if (USB_DeviceState != DEVICE_STATE_Configured) return; /* Select the Joystick Report Endpoint */ Endpoint_SelectEndpoint(JOYSTICK_EPADDR); /* Check to see if the host is ready for another packet */ if (Endpoint_IsINReady()) { USB_JoystickReport_Data_t JoystickReportData; /* Create the next HID report to send to the host */ GetNextReport(&JoystickReportData); /* Write Joystick Report Data */ Endpoint_Write_Stream_LE(&JoystickReportData, sizeof(JoystickReportData), NULL); /* Finalize the stream transfer to send the last packet */ Endpoint_ClearIN(); /* Clear the report data afterwards */ memset(&JoystickReportData, 0, sizeof(JoystickReportData)); }}
开发者ID:BrazzoduroArduino,项目名称:Dougs-Arduino-Stuff,代码行数:28,
示例9: Endpoint_WaitUntilReadyuint8_t Endpoint_WaitUntilReady(void){ #if (USB_STREAM_TIMEOUT_MS < 0xFF) uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; #else uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; #endif for (;;) { if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) { if (Endpoint_IsINReady()) return ENDPOINT_READYWAIT_NoError; } else { if (Endpoint_IsOUTReceived()) return ENDPOINT_READYWAIT_NoError; } if (USB_DeviceState == DEVICE_STATE_Unattached) return ENDPOINT_READYWAIT_DeviceDisconnected; else if (Endpoint_IsStalled()) return ENDPOINT_READYWAIT_EndpointStalled; if (USB_INT_HasOccurred(USB_INT_SOFI)) { USB_INT_Clear(USB_INT_SOFI); if (!(TimeoutMSRem--)) return ENDPOINT_READYWAIT_Timeout; } }}
开发者ID:dfletcher,项目名称:avr-pca9555,代码行数:35,
示例10: PRNT_Device_USBTaskvoid PRNT_Device_USBTask(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo){ if (USB_DeviceState != DEVICE_STATE_Configured) return; #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); if (Endpoint_IsINReady()) PRNT_Device_Flush(PRNTInterfaceInfo); #endif if (PRNTInterfaceInfo->State.IsPrinterReset) { Endpoint_ResetEndpoint(PRNTInterfaceInfo->Config.DataOUTEndpoint.Address); Endpoint_ResetEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataOUTEndpoint.Address); Endpoint_ClearStall(); Endpoint_ResetDataToggle(); Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); Endpoint_ClearStall(); Endpoint_ResetDataToggle(); PRNTInterfaceInfo->State.IsPrinterReset = false; }}
开发者ID:40000ft,项目名称:lufa,代码行数:27,
示例11: TEMPLATE_FUNC_NAMEuint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length){ uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); if (!(Length)) Endpoint_ClearOUT(); while (Length) { if (Endpoint_IsSETUPReceived()) return ENDPOINT_RWCSTREAM_HostAborted; if (USB_DeviceState == DEVICE_STATE_Unattached) return ENDPOINT_RWCSTREAM_DeviceDisconnected; if (Endpoint_IsOUTReceived()) { while (Length && Endpoint_BytesInEndpoint()) { TEMPLATE_TRANSFER_BYTE(DataStream); Length--; } Endpoint_ClearOUT(); } } while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) return ENDPOINT_RWCSTREAM_DeviceDisconnected; } return ENDPOINT_RWCSTREAM_NoError;}
开发者ID:Flaviowebit,项目名称:openCBM,代码行数:35,
示例12: usbGetButtonsvoid usbGetButtons(){ Endpoint_ClearSETUP();//ack setup packet u8 sendData = 0; while (sendData < 3) { while (!Endpoint_IsINReady()) { //wait until host is ready } u8 state = stateButton(but1);; Endpoint_Write_8(state); sendData++; state = stateButton(but2);; Endpoint_Write_8(state); sendData++; state = stateButton(but3);; Endpoint_Write_8(state); sendData++; Endpoint_ClearIN(); } //while (!Endpoint_IsOUTReceived()) { //wait for host to send status } //Endpoint_ClearOUT();//send message //Endpoint_ClearStatusStage();//success :D}
开发者ID:Codingboy,项目名称:ucuni,代码行数:28,
示例13: HID_Taskvoid HID_Task(void){ if (USB_DeviceState != DEVICE_STATE_Configured) return; Endpoint_SelectEndpoint(GENERIC_OUT_EPNUM); if (Endpoint_IsOUTReceived()) { if (Endpoint_IsReadWriteAllowed()) { Endpoint_Read_Stream_LE(&HIDReportInData, sizeof(HIDReportInData), NULL); } Endpoint_ClearOUT(); } Endpoint_SelectEndpoint(GENERIC_IN_EPNUM); if (Endpoint_IsINReady()) { Endpoint_Write_Stream_LE(&HIDReportOutData, sizeof(HIDReportOutData), NULL); memset(&HIDReportOutData, 0, GENERIC_REPORT_SIZE + 1); Endpoint_ClearIN(); }}
开发者ID:HexTank,项目名称:KADE,代码行数:25,
示例14: SendNextReport/** Sends the next HID report to the host, via the IN endpoint. */void SendNextReport(void){ /* Select the IN Report Endpoint */ Endpoint_SelectEndpoint(IN_EPNUM); if (ready && sendReport) { /* Wait until the host is ready to accept another packet */ while (!Endpoint_IsINReady()) {} /* Write IN Report Data */ Endpoint_Write_Stream_LE(report, sizeof(report), NULL); /* Finalize the stream transfer to send the last packet */ Endpoint_ClearIN(); sendReport = 0;#ifdef REPORT_NB_INFO nbReports++; if(!nbReports) { Serial_SendData(info, sizeof(info)); }#endif }}
开发者ID:RalphFox,项目名称:GIMX-firmwares,代码行数:27,
示例15: MIDI_To_Host// From Arduino/Serial to USB/Host void MIDI_To_Host(void){ // Device must be connected and configured for the task to run if (USB_DeviceState != DEVICE_STATE_Configured) return; // Select the MIDI IN stream Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPADDR); if (Endpoint_IsINReady()) { if (mPendingMessageValid == true) { mPendingMessageValid = false; // Write the MIDI event packet to the endpoint Endpoint_Write_Stream_LE(&mCompleteMessage, sizeof(mCompleteMessage), NULL); // Clear out complete message memset(&mCompleteMessage, 0, sizeof(mCompleteMessage)); // Send the data in the endpoint to the host Endpoint_ClearIN(); LEDs_TurnOffLEDs(LEDS_LED2); tx_ticks = TICK_COUNT; } }}
开发者ID:guidokritz,项目名称:KiloMux-Shield,代码行数:30,
示例16: main/** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. */int main(void){ SetupHardware(); RingBuffer_InitBuffer(&USBtoUSART_Buffer, USBtoUSART_Buffer_Data, sizeof(USBtoUSART_Buffer_Data)); RingBuffer_InitBuffer(&USARTtoUSB_Buffer, USARTtoUSB_Buffer_Data, sizeof(USARTtoUSB_Buffer_Data)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { /* Only try to read in bytes from the CDC interface if the transmit buffer is not full */ if (!(RingBuffer_IsFull(&USBtoUSART_Buffer))) { int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); /* Read bytes from the USB OUT endpoint into the USART transmit buffer */ if (!(ReceivedByte < 0)) RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte); } /* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */ uint16_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer); if (BufferCount) { Endpoint_SelectEndpoint(VirtualSerial_CDC_Interface.Config.DataINEndpoint.Address); /* Check if a packet is already enqueued to the host - if so, we shouldn't try to send more data * until it completes as there is a chance nothing is listening and a lengthy timeout could occur */ if (Endpoint_IsINReady()) { /* Never send more than one bank size less one byte to the host at a time, so that we don't block * while a Zero Length Packet (ZLP) to terminate the transfer is sent if the host isn't listening */ uint8_t BytesToSend = MIN(BufferCount, (CDC_TXRX_EPSIZE - 1)); /* Read bytes from the USART receive buffer into the USB IN endpoint */ while (BytesToSend--) { /* Try to send the next byte of data to the host, abort if there is an error without dequeuing */ if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, RingBuffer_Peek(&USARTtoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) { break; } /* Dequeue the already sent byte from the buffer now we have confirmed that no transmission error occurred */ RingBuffer_Remove(&USARTtoUSB_Buffer); } } } /* Load the next byte from the USART transmit buffer into the USART */ if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer))) Serial_SendByte(RingBuffer_Remove(&USBtoUSART_Buffer)); CDC_Device_USBTask(&VirtualSerial_CDC_Interface); USB_USBTask(); }}
开发者ID:aureq,项目名称:TimelapsePlus-Firmware,代码行数:63,
示例17: EVENT_USB_UnhandledControlPacket/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the HID commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */void EVENT_USB_UnhandledControlPacket(void){ /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) { case REQ_SetReport: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); /* Wait until the command (report) has been sent by the host */ while (!(Endpoint_IsOUTReceived())); /* Read in the write destination address */ uint16_t PageAddress = Endpoint_Read_Word_LE(); /* Check if the command is a program page command, or a start application command */ if (PageAddress == TEENSY_STARTAPPLICATION) { RunBootloader = false; } else { /* Erase the given FLASH page, ready to be programmed */ boot_page_erase(PageAddress); boot_spm_busy_wait(); /* Write each of the FLASH page's bytes in sequence */ for (uint8_t PageByte = 0; PageByte < 128; PageByte += 2) { /* Check if endpoint is empty - if so clear it and wait until ready for next packet */ if (!(Endpoint_BytesInEndpoint())) { Endpoint_ClearOUT(); while (!(Endpoint_IsOUTReceived())); } /* Write the next data word to the FLASH page */ boot_page_fill(PageAddress + PageByte, Endpoint_Read_Word_LE()); } /* Write the filled FLASH page to memory */ boot_page_write(PageAddress); boot_spm_busy_wait(); /* Re-enable RWW section */ boot_rww_enable(); } Endpoint_ClearOUT(); /* Acknowledge status stage */ while (!(Endpoint_IsINReady())); Endpoint_ClearIN(); } break; }}
开发者ID:unnamet,项目名称:estick-jtag,代码行数:63,
示例18: Audio_Device_IsReadyForNextSamplebool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo){ if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled)) return false; Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber); return Endpoint_IsINReady();}
开发者ID:Flaviowebit,项目名称:openCBM,代码行数:8,
示例19: main/** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. */int main(void){ SetupHardware(); GlobalInterruptEnable(); uint8_t sending = 0; for (;;) { while (1) { int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); if (ReceivedByte < 0) break; if (!configured) continue; if (!sending) { PORTC.OUTSET = PIN1_bm; sending = 1; } PORTD.OUTTGL = PIN5_bm; while(!USART_IsTXDataRegisterEmpty(&USART)); USART_PutChar(&USART, ReceivedByte & 0xff); } if (sending) { USART_ClearTXComplete(&USART); while(!USART_IsTXComplete(&USART)); PORTC.OUTCLR = PIN1_bm; sending = 0; } Endpoint_SelectEndpoint(VirtualSerial_CDC_Interface.Config.DataINEndpoint.Address); /* Check if a packet is already enqueued to the host - if so, we shouldn't try to send more data * until it completes as there is a chance nothing is listening and a lengthy timeout could occur */ if (configured && Endpoint_IsINReady()) { uint8_t maxbytes = CDC_TXRX_EPSIZE; while (USART_RXBufferData_Available(&USART_data) && maxbytes-->0) { uint8_t b = USART_RXBuffer_GetByte(&USART_data); CDC_Device_SendByte(&VirtualSerial_CDC_Interface, b); PORTD.OUTTGL = PIN5_bm; } } CDC_Device_USBTask(&VirtualSerial_CDC_Interface); USB_USBTask(); if (loop++) continue; if (!configured) continue; PORTD.OUTTGL = PIN5_bm; }}
开发者ID:drthth,项目名称:busware,代码行数:60,
示例20: EVENT_USB_UnhandledControlPacket/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the CDC control commands, * which are all issued via the control endpoint), so that they can be handled appropriately for the application. */void EVENT_USB_UnhandledControlPacket(void){ uint8_t* LineCodingData = (uint8_t*)&LineCoding; /* Process CDC specific control requests */ switch (USB_ControlRequest.bRequest) { case REQ_GetLineEncoding: if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { /* Acknowledge the SETUP packet, ready for data transfer */ Endpoint_ClearSETUP(); /* Write the line coding data to the control endpoint */ Endpoint_Write_Control_Stream_LE(LineCodingData, sizeof(LineCoding)); /* Finalize the stream transfer to send the last packet or clear the host abort */ Endpoint_ClearOUT(); } break; case REQ_SetLineEncoding: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { /* Acknowledge the SETUP packet, ready for data transfer */ Endpoint_ClearSETUP(); /* Read the line coding data in from the host into the global struct */ Endpoint_Read_Control_Stream_LE(LineCodingData, sizeof(LineCoding)); /* Finalize the stream transfer to clear the last packet from the host */ Endpoint_ClearIN(); /* Reconfigure the USART with the new settings */ ReconfigureUSART(); } break; case REQ_SetControlLineState: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { /* Acknowledge the SETUP packet, ready for data transfer */ Endpoint_ClearSETUP(); /* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake lines. The mask is read in from the wValue parameter in USB_ControlRequest, and can be masked against the CONTROL_LINE_OUT_* masks to determine the RTS and DTR line states using the following code: */ /* Acknowledge status stage */ while (!(Endpoint_IsINReady())); Endpoint_ClearIN(); } break; }}
开发者ID:nganmomo,项目名称:avropendous,代码行数:61,
示例21: HID_Taskvoid HID_Task(void){ ring_buffer * _tx_buffer = &tx_buffer_cdc; /* Device must be connected and configured for the task to run */ //if (USB_DeviceState != DEVICE_STATE_Configured) // return; Endpoint_SelectEndpoint(GENERIC_OUT_EPNUM); /* Check to see if a packet has been sent from the host */ if (Endpoint_IsOUTReceived()) { /* Check to see if the packet contains data */ if (Endpoint_IsReadWriteAllowed()) { /* Create a temporary buffer to hold the read in report from the host */ uint8_t GenericData[GENERIC_REPORT_SIZE]; /* Read Generic Report Data */ Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData), NULL); /* Process Generic Report Data */ ProcessGenericHIDReport(GenericData); dataReceived = 1; } /* Finalize the stream transfer to send the last packet */ Endpoint_ClearOUT(); } Endpoint_SelectEndpoint(GENERIC_IN_EPNUM); /* Check to see if the host is ready to accept another packet */ //if (Endpoint_IsINReady() && dataReceived!=0) // && (_tx_buffer->head != _tx_buffer->tail) if (Endpoint_IsINReady()) { /* Create a temporary buffer to hold the report to send to the host */ uint8_t GenericData[GENERIC_REPORT_SIZE]; /* Create Generic Report Data */ CreateGenericHIDReport(GenericData); /* Write Generic Report Data */ Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData), NULL); /* Finalize the stream transfer to send the last packet */ Endpoint_ClearIN(); dataReceived = 0; } }
开发者ID:123jefferson,项目名称:MiniBloq-Sparki,代码行数:56,
示例22: TEMPLATE_FUNC_NAMEuint8_t TEMPLATE_FUNC_NAME (const void* const Buffer, uint16_t Length){ uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); bool LastPacketFull = false; Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN); if (Length > USB_ControlRequest.wLength) Length = USB_ControlRequest.wLength; else if (!(Length)) Endpoint_ClearIN(); while (Length || LastPacketFull) { uint8_t USB_DeviceState_LCL = USB_DeviceState; if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) return ENDPOINT_RWCSTREAM_DeviceDisconnected; else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) return ENDPOINT_RWCSTREAM_BusSuspended; else if (Endpoint_IsSETUPReceived()) return ENDPOINT_RWCSTREAM_HostAborted; else if (Endpoint_IsOUTReceived()) break; if (Endpoint_IsINReady()) { uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize)) { TEMPLATE_TRANSFER_BYTE(DataStream); TEMPLATE_BUFFER_MOVE(DataStream, 1); Length--; BytesInEndpoint++; } LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize); Endpoint_ClearIN(); } } while (!(Endpoint_IsOUTReceived())) { uint8_t USB_DeviceState_LCL = USB_DeviceState; if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) return ENDPOINT_RWCSTREAM_DeviceDisconnected; else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) return ENDPOINT_RWCSTREAM_BusSuspended; } return ENDPOINT_RWCSTREAM_NoError;}
开发者ID:Atarity,项目名称:Lightpack,代码行数:55,
示例23: MIDI_Device_USBTaskvoid MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo){ if (USB_DeviceState != DEVICE_STATE_Configured) return; #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); if (Endpoint_IsINReady()) MIDI_Device_Flush(MIDIInterfaceInfo); #endif}
开发者ID:abcminiuser,项目名称:lufa,代码行数:12,
示例24: CDC_Device_USBTaskvoid CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo){ if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) return; #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); if (Endpoint_IsINReady()) CDC_Device_Flush(CDCInterfaceInfo); #endif}
开发者ID:tewarid,项目名称:ArduinoUnoUsbDfu,代码行数:12,
示例25: Endpoint_GetCurrentEndpointvoid USBSerial::flush(){ uint8_t prevEndpoint = Endpoint_GetCurrentEndpoint(); Endpoint_SelectEndpoint(CDC_TX_EPADDR); bool IsFull = !Endpoint_IsReadWriteAllowed(); Endpoint_ClearIN(); /* Send an empty packet to ensure that the host does not buffer data sent to it */ if (IsFull) { while (!Endpoint_IsINReady() && USB_DeviceState == DEVICE_STATE_Configured) { USB_USBTask(); } Endpoint_ClearIN(); } //Endpoint_WaitUntilReady(); while (!Endpoint_IsINReady() && USB_DeviceState == DEVICE_STATE_Configured) { USB_USBTask(); } Endpoint_SelectEndpoint(prevEndpoint);}
开发者ID:Industruino,项目名称:boarddefinitions,代码行数:22,
示例26: Endpoint_Null_Streamuint8_t Endpoint_Null_Stream(uint16_t Length, uint16_t* const BytesProcessed){ uint32_t i; while ( !Endpoint_IsINReady() ) /*-- Wait until ready --*/ { Delay_MS(2); } for (i=0; i < Length; i++) { Endpoint_Write_8(0); } return ENDPOINT_RWSTREAM_NoError;}
开发者ID:AlexandreN7,项目名称:Liqui_lense,代码行数:15,
示例27: enterBootLoader/* * Delay a little (required), shutdown USB, disable watchdog and interrupts, * and jump to the bootloader. */static voidenterBootLoader(void){ // Control request was handled, so ack it Endpoint_ClearSETUP(); while (!Endpoint_IsINReady()) ; Endpoint_ClearIN(); // Now shut things down and jump to the bootloader. DELAY_MS(100); wdt_disable(); USB_ShutDown(); cli(); cpu_bootloader_start();}
开发者ID:Flaviowebit,项目名称:openCBM,代码行数:20,
示例28: USB_Device_SetAddressstatic void USB_Device_SetAddress(void){ uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); USB_Device_SetDeviceAddress(DeviceAddress); Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); while (!(Endpoint_IsINReady())); USB_Device_EnableDeviceAddress(DeviceAddress); USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;}
开发者ID:cryptovillage,项目名称:badge2016,代码行数:16,
示例29: TEMPLATE_FUNC_NAMEuint8_t TEMPLATE_FUNC_NAME (void* const Buffer, uint16_t Length){ uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); if (!(Length)) Endpoint_ClearOUT(); while (Length) { uint8_t USB_DeviceState_LCL = USB_DeviceState; if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) return ENDPOINT_RWCSTREAM_DeviceDisconnected; else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) return ENDPOINT_RWCSTREAM_BusSuspended; else if (Endpoint_IsSETUPReceived()) return ENDPOINT_RWCSTREAM_HostAborted; if (Endpoint_IsOUTReceived()) { while (Length && Endpoint_BytesInEndpoint()) { TEMPLATE_TRANSFER_BYTE(DataStream); TEMPLATE_BUFFER_MOVE(DataStream, 1); Length--; } Endpoint_ClearOUT(); } } while (!(Endpoint_IsINReady())) { uint8_t USB_DeviceState_LCL = USB_DeviceState; if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) return ENDPOINT_RWCSTREAM_DeviceDisconnected; else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) return ENDPOINT_RWCSTREAM_BusSuspended; } return ENDPOINT_RWCSTREAM_NoError;}
开发者ID:AdjacentReality,项目名称:lufa-lib,代码行数:46,
示例30: USB_Device_SetAddressstatic void USB_Device_SetAddress(void){ uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); GlobalInterruptDisable(); Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); while (!(Endpoint_IsINReady())); USB_Device_SetDeviceAddress(DeviceAddress); USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default; SetGlobalInterruptMask(CurrentGlobalInt);}
开发者ID:NeuronRobotics,项目名称:microcontroller-sample,代码行数:17,
注:本文中的Endpoint_IsINReady函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Endpoint_IsOUTReceived函数代码示例 C++ Endpoint_ConfigureEndpoint函数代码示例 |