您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Endpoint_Write_Control_Stream_LE函数代码示例

51自学网 2021-06-01 20:38:10
  C++
这篇教程C++ Endpoint_Write_Control_Stream_LE函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Endpoint_Write_Control_Stream_LE函数的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint_Write_Control_Stream_LE函数的具体用法?C++ Endpoint_Write_Control_Stream_LE怎么用?C++ Endpoint_Write_Control_Stream_LE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Endpoint_Write_Control_Stream_LE函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */void EVENT_USB_Device_ControlRequest(void){	/* Handle HID Class specific requests */	switch (USB_ControlRequest.bRequest)	{		case HID_REQ_GetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				if(USB_ControlRequest.wValue == 0x0300) {					Endpoint_ClearSETUP();					Endpoint_Write_Control_Stream_LE(ps3_magic_bytes, sizeof(ps3_magic_bytes));					Endpoint_ClearOUT();				} else {					Endpoint_ClearSETUP();					/* Write the report data to the control endpoint */					Endpoint_Write_Control_Stream_LE(&gamepad_state, sizeof(gamepad_state));					Endpoint_ClearOUT();				}			}			break;	}}
开发者ID:HexTank,项目名称:KADE,代码行数:30,


示例2: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */void EVENT_USB_Device_ControlRequest(void){  static unsigned char buffer[MAX_CONTROL_TRANSFER_SIZE];  unsigned char len = 0;  /* Handle HID Class specific requests */	switch (USB_ControlRequest.bRequest)	{		case REQ_GetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{			  if(USB_ControlRequest.wValue == 0x0303)        {          memcpy_P(buffer, buf03, sizeof(buf03));          len = sizeof(buf03);          Endpoint_ClearSETUP();          Endpoint_Write_Control_Stream_LE(buffer, len);          Endpoint_ClearOUT();          ready = 1;        }        else if(USB_ControlRequest.wValue == 0x03f3)        {          memcpy_P(buffer, buff3, sizeof(buff3));          len = sizeof(buff3);          Endpoint_ClearSETUP();          Endpoint_Write_Control_Stream_LE(buffer, len);          Endpoint_ClearOUT();        }        else if(USB_ControlRequest.wValue == 0x03f1             || USB_ControlRequest.wValue == 0x03f2)        {          spoofReply = 0;          send_spoof_header();          while(!spoofReply);          Endpoint_ClearSETUP();          Endpoint_Write_Control_Stream_LE(buf, spoofReplyLen);          Endpoint_ClearOUT();        }			}					break;		case REQ_SetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{        Endpoint_ClearSETUP();        Endpoint_Read_Control_Stream_LE(buffer, USB_ControlRequest.wLength);        Endpoint_ClearIN();        if(USB_ControlRequest.wValue == 0x03f0)        {          send_spoof_header();          Serial_SendData(buffer, USB_ControlRequest.wLength);        }			}						break;	}}
开发者ID:RalphFox,项目名称:GIMX-firmwares,代码行数:62,


示例3: USB_Device_GetDescriptor

static void USB_Device_GetDescriptor(void){	const void* DescriptorPointer;	uint16_t    DescriptorSize;	#if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && /	    !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS))	uint8_t DescriptorAddressSpace;	#endif	#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)	if (USB_ControlRequest.wValue == ((DTYPE_String << 8) | USE_INTERNAL_SERIAL))	{		USB_Device_GetInternalSerialDescriptor();		return;	}	#endif	if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,	                                                 &DescriptorPointer	#if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && /	    !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS))	                                                 , &DescriptorAddressSpace	#endif													 )) == NO_DESCRIPTOR)	{		return;	}	Endpoint_ClearSETUP();	#if defined(USE_RAM_DESCRIPTORS) || !defined(ARCH_HAS_MULTI_ADDRESS_SPACE)	Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);	#elif defined(USE_EEPROM_DESCRIPTORS)	Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);	#elif defined(USE_FLASH_DESCRIPTORS)	Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);	#else	if (DescriptorAddressSpace == MEMSPACE_FLASH)	  Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);	else if (DescriptorAddressSpace == MEMSPACE_EEPROM)	  Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);	else	  Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);	#endif	Endpoint_ClearOUT();}
开发者ID:NeuronRobotics,项目名称:microcontroller-sample,代码行数:48,


示例4: 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_GetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				USB_JoystickReport_Data_t JoystickReportData;								Endpoint_ClearSETUP();				/* Create the next HID report to send to the host */								GetNextReport(&JoystickReportData);									/* Write the report data to the control endpoint */				Endpoint_Write_Control_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));								/* Finalize the stream transfer to send the last packet or clear the host abort */				Endpoint_ClearOUT();			}					break;	}}
开发者ID:unnamet,项目名称:estick-jtag,代码行数:29,


示例5: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */void EVENT_USB_Device_ControlRequest(void){	/* Process CDC specific control requests */	switch (USB_ControlRequest.bRequest)	{		case REQ_GetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Write the line coding data to the control endpoint */				Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));				Endpoint_ClearOUT();			}			break;		case REQ_SetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Read the line coding data in from the host into the global struct */				Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));				Endpoint_ClearIN();			}			break;	}}
开发者ID:hagna,项目名称:phonemes2text,代码行数:33,


示例6: EVENT_USB_Device_UnhandledControlRequest

/** 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_Device_UnhandledControlRequest(void){	uint8_t* ReportData;	uint8_t  ReportSize;	/* Handle HID Class specific requests */	switch (USB_ControlRequest.bRequest)	{		case REQ_GetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();					/* Determine if it is the mouse or the keyboard data that is being requested */				if (!(USB_ControlRequest.wIndex))				{					ReportData = (uint8_t*)&KeyboardReportData;					ReportSize = sizeof(KeyboardReportData);				}				else				{					ReportData = (uint8_t*)&MouseReportData;					ReportSize = sizeof(MouseReportData);				}				/* Write the report data to the control endpoint */				Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);				/* Clear the report data afterwards */				memset(ReportData, 0, ReportSize);								/* Finalize the stream transfer to send the last packet or clear the host abort */				Endpoint_ClearOUT();			}					break;		case REQ_SetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();								/* Wait until the LED report has been sent by the host */				while (!(Endpoint_IsOUTReceived()))				{					if (USB_DeviceState == DEVICE_STATE_Unattached)					  return;				}				/* Read in and process the LED report from the host */				Keyboard_ProcessLEDReport(Endpoint_Read_Byte());				/* Clear the endpoint data */				Endpoint_ClearOUT();				Endpoint_ClearStatusStage();			}						break;	}}
开发者ID:emcute0319,项目名称:ir-usb-kbd,代码行数:64,


示例7: EVENT_USB_Device_ControlRequest

void EVENT_USB_Device_ControlRequest(void){    switch (USB_ControlRequest.bRequest)    {        case HID_REQ_GetReport:            if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))            {                Endpoint_ClearSETUP();                Endpoint_Write_Control_Stream_LE(&HIDReportOutData, sizeof(HIDReportOutData));                memset(&HIDReportOutData, 0, GENERIC_REPORT_SIZE + 1);                Endpoint_ClearOUT();            }            break;        case HID_REQ_SetReport:            if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))            {                Endpoint_ClearSETUP();                Endpoint_Read_Control_Stream_LE(&HIDReportInData, sizeof(HIDReportInData));                Endpoint_ClearIN();            }            break;    }}
开发者ID:HexTank,项目名称:KADE,代码行数:25,


示例8: PRNT_Device_ProcessControlRequest

void 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,


示例9: process_get

/** * /brief Get the current focuser state * * The GET request returns a single byte containing the state of all * the output ports. */void	process_get() {	Endpoint_ClearSETUP();	unsigned short	v[3];	v[0] = motor_current();	v[1] = motor_target();	v[2] = motor_speed();	Endpoint_Write_Control_Stream_LE((void *)v, 6);	Endpoint_ClearOUT();}
开发者ID:AndreasFMueller,项目名称:Focuser,代码行数:15,


示例10: 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,


示例11: sendControlMessage

void sendControlMessage(uint8_t* data, uint8_t length) {    uint8_t previousEndpoint = Endpoint_GetCurrentEndpoint();    Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);    Endpoint_ClearSETUP();    Endpoint_Write_Control_Stream_LE(data, length);    Endpoint_ClearOUT();    Endpoint_SelectEndpoint(previousEndpoint);}
开发者ID:fulnonono,项目名称:cantranslator,代码行数:10,


示例12: do_fw_revision

static void do_fw_revision(int direction, unsigned int vWalue){	char fwrev[9];	if (direction == ENDPOINT_DIR_IN) {		memset(fwrev, ' ', 9);		snprintf(fwrev, 9, "%s", conf.fw_revision);		fwrev[8] = '/0';		Endpoint_Write_Control_Stream_LE(fwrev, 8);	}}
开发者ID:johandc,项目名称:bluebox,代码行数:11,


示例13: EVENT_USB_Device_ControlRequest

void EVENT_USB_Device_ControlRequest(void){    void* buffer = NULL;    uint16_t length =  0;    if(change != NULL) {        usb_set_device(change, 1);        Endpoint_ClearSETUP();        Endpoint_ClearIN();        Endpoint_ClearOUT();    } else {         Endpoint_ClearSETUP();    }    uart_print("Type: %x, req: %x, val: %x, idx: %x, len: %d/n",                USB_ControlRequest.bmRequestType,                USB_ControlRequest.bRequest,                USB_ControlRequest.wValue,                USB_ControlRequest.wIndex,                USB_ControlRequest.wLength);    device->handle_configuration(   device,                                    USB_ControlRequest.bmRequestType,                                    USB_ControlRequest.bRequest,                                    USB_ControlRequest.wValue,                                    USB_ControlRequest.wIndex,                                    USB_ControlRequest.wLength,                                    &buffer,                                    &length);    if(buffer) {        if(length == 0xFFFF) {            return;        }        if(length) {            if(length & CONST_PTR) {                Endpoint_Write_Control_PStream_LE(buffer, length & ~CONST_PTR);            } else {                Endpoint_Write_Control_Stream_LE(buffer, length);            }        }        Endpoint_ClearStatusStage();        if(deferred_addr >= 0) {            _usb_set_addr(deferred_addr);            uart_print("Setting addr to %d/n", deferred_addr);            deferred_addr = -1;        }    } else {        Endpoint_StallTransaction();        uart_print("STALLED!/n");    }}
开发者ID:Austin503,项目名称:HubCap,代码行数:54,


示例14: CDC_Device_ProcessControlRequest

void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo){	if (!(Endpoint_IsSETUPReceived()))	  return;	  	if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber)	  return;	switch (USB_ControlRequest.bRequest)	{		case CDC_REQ_GetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				Endpoint_Write_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));				Endpoint_ClearOUT();			}						break;		case CDC_REQ_SetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));				Endpoint_ClearIN();				EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);			}				break;		case CDC_REQ_SetControlLineState:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{								Endpoint_ClearSETUP();				Endpoint_ClearStatusStage();				CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue;				EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);			}				break;		case CDC_REQ_SendBreak:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{								Endpoint_ClearSETUP();				Endpoint_ClearStatusStage();				EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue);			}			break;	}}
开发者ID:123jefferson,项目名称:MiniBloq-Sparki,代码行数:54,


示例15: EVENT_USB_Device_ControlRequest

void EVENT_USB_Device_ControlRequest(void){	uint8_t* ReportData;	uint8_t  ReportSize;    	/* Handle HID Class specific requests */	switch (USB_ControlRequest.bRequest)	{		case HID_REQ_GetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();                                                		switch( USB_ControlRequest.wIndex )		                {		                    case 0:							// todo                	            	break;                          	    		                    case 1:     					ReportData = (uint8_t*)&KeyboardReportData;					ReportSize = sizeof(KeyboardReportData);	                                Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);					Endpoint_ClearOUT();	                                break;        		        }			}			break;		case HID_REQ_SetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				switch( USB_ControlRequest.wIndex )				{				    				    case 0 : 						// todo				        break;				    case 1:						// todo				        break;				}			}		break;	}}
开发者ID:12019,项目名称:mooltipass,代码行数:53,


示例16: do_serialnumber

static void do_serialnumber(int direction, unsigned int vWalue){	uint32_t snum;	if (direction == ENDPOINT_DIR_OUT) {		Endpoint_Read_Control_Stream_LE(&snum, sizeof(snum));		eeprom_write_dword(&serialno, snum);	} else if (direction == ENDPOINT_DIR_IN) {		snum = eeprom_read_dword(&serialno);		Endpoint_Write_Control_Stream_LE(&snum, sizeof(snum));	}}
开发者ID:johandc,项目名称:bluebox,代码行数:12,


示例17: do_frequency

static void do_frequency(int direction, unsigned int wValue){	uint32_t freq;	if (direction == ENDPOINT_DIR_OUT) {		Endpoint_Read_Control_Stream_LE(&freq, sizeof(freq));		conf.tx_freq = freq;		conf.rx_freq = freq;		conf_set_reconf();	} else if (direction == ENDPOINT_DIR_IN) {		Endpoint_Write_Control_Stream_LE(&conf.rx_freq, sizeof(conf.rx_freq)); /	}}
开发者ID:johandc,项目名称:bluebox,代码行数:13,


示例18: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */int EVENT_USB_Device_ControlRequest(void){	/* Ignore any requests that aren't directed to the CDC interface */	if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) !=	    (REQTYPE_CLASS | REQREC_INTERFACE))	{		return 0;	}	/* Activity - toggle indicator LEDs */	LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);	/* Process CDC specific control requests */	switch (USB_ControlRequest.bRequest)	{		case CDC_REQ_GetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Write the line coding data to the control endpoint */				Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));				Endpoint_ClearOUT();				return 1;			}			break;		case CDC_REQ_SetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Read the line coding data in from the host into the global struct */				Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));				Endpoint_ClearIN();				return 1;			}			break;        case CDC_REQ_SetControlLineState:	        if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))	        {	            Endpoint_ClearSETUP();	            Endpoint_ClearStatusStage();	            return 1;	        }	        break;	}	return 0;}
开发者ID:agprimatic,项目名称:lufa,代码行数:55,


示例19: USB_Device_GetDescriptor

static void USB_Device_GetDescriptor(void){	const void* DescriptorPointer;	uint16_t    DescriptorSize;	if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,	                                                 &DescriptorPointer													 )) == NO_DESCRIPTOR)	{		return;	}	Endpoint_ClearSETUP();	Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);}
开发者ID:AlfredArouna,项目名称:USB_CDC,代码行数:14,


示例20: EVENT_USB_Device_UnhandledControlRequest

/** Event handler for the USB_UnhandledControlRequest 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_Device_UnhandledControlRequest(void){	/* Determine which interface's Line Coding data is being set from the wIndex parameter */	uint8_t* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? (uint8_t*)&LineEncoding1 : (uint8_t*)&LineEncoding2;	/* 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(LineEncodingData, sizeof(CDC_Line_Coding_t));								/* 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(LineEncodingData, sizeof(CDC_Line_Coding_t));				/* Finalize the stream transfer to clear the last packet from the host */				Endpoint_ClearIN();			}				break;		case REQ_SetControlLineState:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				/* Acknowledge the SETUP packet, ready for data transfer */				Endpoint_ClearSETUP();								Endpoint_ClearStatusStage();			}				break;	}}
开发者ID:sankeq,项目名称:ethersex,代码行数:52,


示例21: do_register

static void do_register(int direction, unsigned int regnum){	uint32_t value;	adf_reg_t reg;	if (direction == ENDPOINT_DIR_OUT) {		Endpoint_Read_Control_Stream_LE(&value, sizeof(value));		value = (value & ~0xf) | (regnum & 0xf);		reg.whole_reg = value;		adf_write_reg(&reg);	} else if (direction == ENDPOINT_DIR_IN) {		reg = adf_read_reg(regnum);		value = reg.whole_reg;		Endpoint_Write_Control_Stream_LE(&value, sizeof(value));	}}
开发者ID:johandc,项目名称:bluebox,代码行数:16,


示例22: USB_Device_GetInternalSerialDescriptor

static void USB_Device_GetInternalSerialDescriptor(void){	struct	{		USB_Descriptor_Header_t Header;		uint16_t                UnicodeString[INTERNAL_SERIAL_LENGTH_BITS / 4];	} SignatureDescriptor;	SignatureDescriptor.Header.Type = DTYPE_String;	SignatureDescriptor.Header.Size = USB_STRING_LEN(INTERNAL_SERIAL_LENGTH_BITS / 4);		USB_Device_GetSerialString(SignatureDescriptor.UnicodeString);	Endpoint_ClearSETUP();	Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor));	Endpoint_ClearOUT();}
开发者ID:NeuronRobotics,项目名称:microcontroller-sample,代码行数:18,


示例23: RNDIS_Device_ProcessControlRequest

void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo){	if (!(Endpoint_IsSETUPReceived()))	  return;	  	if (USB_ControlRequest.wIndex != RNDISInterfaceInfo->Config.ControlInterfaceNumber)	  return;	switch (USB_ControlRequest.bRequest)	{		case REQ_SendEncapsulatedCommand:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				Endpoint_Read_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, USB_ControlRequest.wLength);				Endpoint_ClearIN();				RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo);			}						break;		case REQ_GetEncapsulatedResponse:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;				if (!(MessageHeader->MessageLength))				{					RNDISInterfaceInfo->State.RNDISMessageBuffer[0] = 0;					MessageHeader->MessageLength = 1;				}				Endpoint_Write_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, MessageHeader->MessageLength);								Endpoint_ClearOUT();				MessageHeader->MessageLength = 0;			}				break;	}}
开发者ID:geemoo,项目名称:oopslogger,代码行数:44,


示例24: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */void EVENT_USB_Device_ControlRequest(void){	/* Process RNDIS class commands */	switch (USB_ControlRequest.bRequest)	{		case RNDIS_REQ_SendEncapsulatedCommand:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Read in the RNDIS message into the message buffer */				Endpoint_Read_Control_Stream_LE(RNDISMessageBuffer, USB_ControlRequest.wLength);				Endpoint_ClearIN();				/* Process the RNDIS message */				ProcessRNDISControlMessage();			}			break;		case RNDIS_REQ_GetEncapsulatedResponse:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				/* Check if a response to the last message is ready */				if (!(MessageHeader->MessageLength))				{					/* Set the response to a single 0x00 byte to indicate that no response is ready */					RNDISMessageBuffer[0] = 0;					MessageHeader->MessageLength = 1;				}				Endpoint_ClearSETUP();				/* Write the message response data to the endpoint */				Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, MessageHeader->MessageLength);				Endpoint_ClearOUT();				/* Reset the message header once again after transmission */				MessageHeader->MessageLength = 0;			}			break;	}}
开发者ID:DuinoPilot,项目名称:lufa,代码行数:47,


示例25: do_acf

static void do_acf(int direction, unsigned int vWalue){	struct afc_request req;	if (direction == ENDPOINT_DIR_OUT) {		Endpoint_Read_Control_Stream_LE(&req, sizeof(req));		conf.afc_enable = !!req.state;		conf.afc_range = req.range ? req.range : conf.afc_range;		conf.afc_kp = req.p ? req.p : conf.afc_kp;		conf.afc_ki = req.i ? req.i : conf.afc_ki;		conf_set_reconf();	} else if (direction == ENDPOINT_DIR_IN) {		req.state = conf.afc_enable;		req.range = conf.afc_range;		req.p = conf.afc_kp;		req.i = conf.afc_ki;		Endpoint_Write_Control_Stream_LE(&req, sizeof(req));	}}
开发者ID:johandc,项目名称:bluebox,代码行数:19,


示例26: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */void EVENT_USB_Device_ControlRequest(void){	/* Process CDC specific control requests */	switch (USB_ControlRequest.bRequest)	{		case CDC_REQ_GetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Write the line coding data to the control endpoint */				Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));				Endpoint_ClearOUT();			}			break;		case CDC_REQ_SetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Read the line coding data in from the host into the global struct */				Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t));				Endpoint_ClearIN();			}			break;		case CDC_REQ_SetControlLineState:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				Endpoint_ClearStatusStage();				/* 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:				*/			}			break;	}}
开发者ID:Steffen-Engel,项目名称:lufa,代码行数:46,


示例27: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */void EVENT_USB_Device_ControlRequest(void){	/* Determine which interface's Line Coding data is being set from the wIndex parameter */	void* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? &LineEncoding1 : &LineEncoding2;	/* Process CDC specific control requests */	switch (USB_ControlRequest.bRequest)	{		case CDC_REQ_GetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Write the line coding data to the control endpoint */				Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t));				Endpoint_ClearOUT();			}			break;		case CDC_REQ_SetLineEncoding:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Read the line coding data in from the host into the global struct */				Endpoint_Read_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t));				Endpoint_ClearIN();			}			break;		case CDC_REQ_SetControlLineState:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				Endpoint_ClearStatusStage();			}			break;	}}
开发者ID:AmesianX,项目名称:OpenPCR,代码行数:44,


示例28: EVENT_USB_Device_UnhandledControlRequest

voidEVENT_USB_Device_UnhandledControlRequest(void){    uint8_t replyBuf[XUM_DEVINFO_SIZE];    int8_t len;    /*     * Ignore non-class requests. We also only handle commands     * that don't transfer any data or just transfer it into the host.     */    if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_TYPE) !=        REQTYPE_CLASS) {        DEBUGF(DBG_ERROR, "bad ctrl req %x/n",            USB_ControlRequest.bmRequestType);        return;    }    // Process the command and get any returned data    memset(replyBuf, 0, sizeof(replyBuf));    len = usbHandleControl(USB_ControlRequest.bRequest, replyBuf);    if (len == -1) {        DEBUGF(DBG_ERROR, "ctrl req err/n");        board_set_status(STATUS_ERROR);        return;    }    // Control request was handled so ack it to allow another    Endpoint_ClearSETUP();    // Send data back to host and finalize the status phase    if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_DIRECTION) ==        REQDIR_DEVICETOHOST) {        Endpoint_Write_Control_Stream_LE(replyBuf, len);        Endpoint_ClearOUT();    } else {        while (!Endpoint_IsINReady())            ;        Endpoint_ClearIN();    }}
开发者ID:Flaviowebit,项目名称:openCBM,代码行数:40,


示例29: EVENT_USB_Device_UnhandledControlRequest

/** Event handler for the USB_UnhandledControlRequest 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_Device_UnhandledControlRequest(void){	//NOTE - this is here as a template only, LoopBack does not make use of it	/* Handle HID Class specific requests */	switch (USB_ControlRequest.bRequest)	{		case 0x01:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				Endpoint_ClearSETUP();				/* Write data to the control endpoint */				Endpoint_Write_Control_Stream_LE(&dataToSend, sizeof(dataToSend));				/* Finalize the stream transfer to send the last packet or clear the host abort */				Endpoint_ClearOUT();			}					break;	}}
开发者ID:nganmomo,项目名称:avropendous,代码行数:26,


示例30: EVENT_USB_Device_ControlRequest

/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to *  the device from the USB host before passing along unhandled control requests to the library for processing *  internally. */void EVENT_USB_Device_ControlRequest(void){	/* Handle HID Class specific requests */	switch (USB_ControlRequest.bRequest)	{		case HID_REQ_GetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))			{				uint8_t GenericData[GENERIC_REPORT_SIZE];				CreateGenericHIDReport(GenericData);				Endpoint_ClearSETUP();				/* Write the report data to the control endpoint */				Endpoint_Write_Control_Stream_LE(&GenericData, sizeof(GenericData));				Endpoint_ClearOUT();			}			break;		case HID_REQ_SetReport:			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))			{				uint8_t GenericData[GENERIC_REPORT_SIZE];				Endpoint_ClearSETUP();				/* Read the report data from the control endpoint */				Endpoint_Read_Control_Stream_LE(&GenericData, sizeof(GenericData));				Endpoint_ClearIN();				ProcessGenericHIDReport(GenericData);			}			break;	}}
开发者ID:chicagoedt,项目名称:Firmware,代码行数:40,



注:本文中的Endpoint_Write_Control_Stream_LE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Endpoint_Write_Stream_LE函数代码示例
C++ Endpoint_Write_8函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。