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

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

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

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

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

示例1: main

int main(){  // SET single LED port  DDRC |= _BV(LED_PIN);  PORTC ^= _BV(LED_PIN);  // 1s pull up of LED Strip pins */  apa102_DDRREG &= ~_BV(apa102_data);  apa102_DDRREG &= ~_BV(apa102_clk);  apa102_PORTREG |= _BV(apa102_data);  apa102_PORTREG |= _BV(apa102_clk);  _delay_ms(900);  // Disable pull ups  apa102_PORTREG &= ~_BV(apa102_data);  apa102_PORTREG &= ~_BV(apa102_clk);  apa102_DDRREG |= _BV(apa102_data);  apa102_DDRREG |= _BV(apa102_clk);  _delay_ms(100);  PORTC ^= _BV(LED_PIN);  // Clear LEDs in the strip  clear_all_leds();  // Init ROS  nh.initNode();  nh.subscribe(set_sub);  nh.subscribe(set_led_sub);  ack_led();  // Wait for Server side to start  while (!nh.connected())  {    nh.spinOnce();    // LUFA functions that need to be called frequently to keep USB alive    CDC_Device_USBTask(&Atmega32u4Hardware::VirtualSerial_CDC_Interface);    USB_USBTask();    _delay_ms(10);  }  ack_led();  // Publish some debug information  snprintf(log_str, MAX_MSG_SIZE, "V:%s", GIT_VERSION);  nh.loginfo(log_str);  snprintf(log_str, MAX_MSG_SIZE, "FM:%d", get_free_ram());  nh.loginfo(log_str);  while(1)  {    nh.spinOnce();    // LUFA functions that need to be called frequently to keep USB alive    CDC_Device_USBTask(&Atmega32u4Hardware::VirtualSerial_CDC_Interface);    USB_USBTask();  }  return 0;}
开发者ID:Voidminded,项目名称:autonomy_leds,代码行数:57,


示例2: main

int main(void){  SetupHardware();  /* Create a regular character stream for the interface so that it can be used with the stdio.h functions */  CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);  GlobalInterruptEnable();  while(1)  {    DebounceUpdate();    EncoderUpdate();    LedUpdate();    SendSerial();    /* Must throw away unused bytes from the host, or it will lock up while waiting for the device */    CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);    CDC_Device_USBTask(&VirtualSerial_CDC_Interface);    HID_Device_USBTask(&Mouse_HID_Interface);    HID_Device_USBTask(&Keyboard_HID_Interface);    USB_USBTask();  }}
开发者ID:Hylian,项目名称:sdvx,代码行数:27,


示例3: VncServerGetData

int16_t VncServerGetData(uint8_t * buffer, uint16_t maxsize){    uint16_t size = 0;    if(usbConnectionReset)    {        usbConnectionReset = false;        return -1;    }    CDC_Device_USBTask(&VirtualSerial_CDC_Interface);    USB_USBTask();    while(debugcounter > 64)    {        DDRF |= (1 << 0);        PORTF |= (1 << 0);        debugcounter -= 64;        PORTF &= ~(1 << 0);    }    while ( size < maxsize )    {        int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);        if(ReceivedByte < 0)            break;        buffer[size++] = (uint8_t)ReceivedByte;        debugcounter++;    }    return size;}
开发者ID:embedded-creations,项目名称:Networked-Display,代码行数:33,


示例4: 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){	stdout=&mystdout;	stdin=&mystdin;	SetupHardware();	//LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);	GlobalInterruptEnable();	//Eval Prototype Sharp Reset Pin	//DDRB &= ~RESET_PIN; //Set Input	//PORTB |= RESET_PIN; //Set High	//DDRB |= RESET_PIN; //Set Output	//Drude Sharp LCD Reset PIN	PORTF |= RESETN_PIN; //Set High	DDRF |= RESETN_PIN; //Set Output		//Digitizer Interrupt	//DDRB &= ~(_BV(7)); //PB7 input	//PORTB &= ~(1<<PB7); //PB7 low	PORTB |= (_BV(7)); //Set high (input pullup)		//IP4787CZ32Y HDMI ESD interface chip (HDMI_ACT PIN) Active-High (Test-Point 12)	PORTF |= (_BV(PF1)); //Set high (input pullup)		//Toshiba Interrupt Pin	PORTE |= (_BV(PE6)); //Set high (input pullup)	//Toshiba Standby Pin	PORTF |= (_BV(PF4)); //Set high (input pullup)	//Toshiba Reset Pin - Active Low	PORTC |= (_BV(PC7)); //Set high (input pullup)	//LCD-CABC	//PORTF |= (_BV(PF7)); //Set high (defaults to input pullup)	//DDRF &= ~(_BV(PF7)); //Set output	//PORTF |= (_BV(PF7)); //Set low	//LED-PWM	PORTD |= (_BV(PD6)); //Set high (defaults to input pullup)	//PORTD &= ~(_BV(PD6)); //Set low	//DDRD &= ~(_BV(PD6)); //Set output	RingBuffer_InitBuffer(&FromHost_Buffer, FromHost_Buffer_Data, sizeof(FromHost_Buffer_Data));	init_screen(0x1F); //magic number!		mxt_list_types();	for (;;)	{		HandleSerial();		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		HID_Device_USBTask(&Digitizer_HID_Interface);		USB_USBTask();		HandleDigitizer();	}}
开发者ID:ultimachine,项目名称:Drude-Firmware,代码行数:63,


示例5: 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();	/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */	CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);	GlobalInterruptEnable();	_setBrightness(50);	for (;;)	{		/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */		CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();		DS1302_clock_burst_read((uint8_t *) &rtc);		_setDigit( rtc.Seconds % 10 );		_setBrightness( 50 );		_delay_ms(4);    }}
开发者ID:koolatron,项目名称:herbert,代码行数:30,


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


示例7: 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();	/* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */	CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream);	sei();	for (;;)	{		/* Read in next LED colour command from the host */		uint8_t ColourUpdate = fgetc(&USBSerialStream);		/* Top 3 bits select the LED, bottom 5 control the brightness */		uint8_t Channel = (ColourUpdate & 0b11100000);		uint8_t Duty    = (ColourUpdate & 0b00011111);		if (Channel & (1 << 5))		  SoftPWM_Channel1_Duty = Duty;		if (Channel & (1 << 6))		  SoftPWM_Channel2_Duty = Duty;		if (Channel & (1 << 7))		  SoftPWM_Channel3_Duty = Duty;		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();	}}
开发者ID:AdjacentReality,项目名称:lufa-lib,代码行数:34,


示例8: main

intmain(void) {  uint8_t i = 1;  uint8_t count = 3;  setup();  blink(3);  _delay_ms(100);  while (1) {    // Print greeting at most count times.    if (i <= count) {      if (USB_DeviceState == DEVICE_STATE_Configured && ok_to_send) {        blink(i);        CDC_Device_SendString(&VirtualSerial_CDC_Interface, "Hello World! ");        CDC_Device_SendByte(&VirtualSerial_CDC_Interface, '0' + i);        CDC_Device_SendString(&VirtualSerial_CDC_Interface, "/r/n");        CDC_Device_Flush(&VirtualSerial_CDC_Interface);        i++;      }    }    if (USB_DeviceState == DEVICE_STATE_Configured) {      /* Must throw away unused bytes from the host, or it will lock up         while waiting for the device */      CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);    }    CDC_Device_USBTask(&VirtualSerial_CDC_Interface);    USB_USBTask();  }}
开发者ID:neonquill,项目名称:xmega-usb-serial,代码行数:33,


示例9: 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);	RingBuffer_InitBuffer(&USARTtoUSB_Buffer);	sei();	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 */		RingBuff_Count_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer);		if ((TIFR0 & (1 << TOV0)) || (BufferCount > BUFFER_NEARLY_FULL))		{			TIFR0 |= (1 << TOV0);			if (USARTtoUSB_Buffer.Count) {				LEDs_TurnOnLEDs(LEDMASK_TX);				PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;			}			/* Read bytes from the USART receive buffer into the USB IN endpoint */			while (BufferCount--)			  CDC_Device_SendByte(&VirtualSerial_CDC_Interface, RingBuffer_Remove(&USARTtoUSB_Buffer));			/* Turn off TX LED(s) once the TX pulse period has elapsed */			if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse))			  LEDs_TurnOffLEDs(LEDMASK_TX);			/* Turn off RX LED(s) once the RX pulse period has elapsed */			if (PulseMSRemaining.RxLEDPulse && !(--PulseMSRemaining.RxLEDPulse))			  LEDs_TurnOffLEDs(LEDMASK_RX);		}		/* Load the next byte from the USART transmit buffer into the USART */		if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer))) {		  Serial_TxByte(RingBuffer_Remove(&USBtoUSART_Buffer));		  	LEDs_TurnOnLEDs(LEDMASK_RX);			PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS;		}		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();	}}
开发者ID:pmjdebruijn,项目名称:gnoduino,代码行数:60,


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


示例11: main

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(0);	sei();	for (;;)	{		if ((PINF & 0x01) == 0x01)			LEDs_SetAllLEDs(2);		else			LEDs_SetAllLEDs(0);		/* Only try to read in bytes from the CDC interface if the (outbound) 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 ((TIFR0 & (1 << TOV0)) || (BufferCount > (uint8_t)(sizeof(USARTtoUSB_Buffer_Data) * .75)))		{			/* Clear flush timer expiry flag */			TIFR0 |= (1 << TOV0);			/* Read bytes from the USART receive buffer into the USB IN endpoint */			while (BufferCount--)			{				/* 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:ASHOK1991,项目名称:lb-Arduino-Code,代码行数:57,


示例12: ISR

// This ISR is responsible for running the USB code.  It MUST run at least// every 30mS.  I'm probably going to start running it twice that often.ISR(TIMER0_OVF_vect, ISR_NOBLOCK){    // Increment the ticks counter    // which will overflow once every 536 seconds, or 8.94 minutes.    ticks++;        CDC_Device_USBTask(&CDC_interface);    USB_USBTask();}
开发者ID:hpux735,项目名称:MRF49XA-Dongle,代码行数:11,


示例13: 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(&FromHost_Buffer, FromHost_Buffer_Data, sizeof(FromHost_Buffer_Data));	GlobalInterruptEnable();	for (;;)	{		/* Only try to read in bytes from the CDC interface if the transmit buffer is not full */		if (!(RingBuffer_IsFull(&FromHost_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(&FromHost_Buffer, ReceivedByte);		}		while (RingBuffer_GetCount(&FromHost_Buffer) > 0)		{			static uint8_t EscapePending = 0;			int16_t HD44780Byte = RingBuffer_Remove(&FromHost_Buffer);			if (HD44780Byte == COMMAND_ESCAPE)			{				if (EscapePending)				{					HD44780_WriteData(HD44780Byte);					EscapePending = 0;				}				else				{					/* Next received character is the command byte */					EscapePending = 1;				}			}			else			{				if (EscapePending)				{					HD44780_WriteCommand(HD44780Byte);					EscapePending = 0;				}				else				{					HD44780_WriteData(HD44780Byte);				}			}		}		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();	}}
开发者ID:agprimatic,项目名称:lufa,代码行数:59,


示例14: usb_tasks

void usb_tasks(void){  MS_Device_USBTask(&Disk_MS_Interface);  CDC_Device_USBTask(&VirtualSerial_CDC_Interface);  HID_Device_USBTask(&Keyboard_HID_Interface);  USB_USBTask();  if(usb_keyboard_sending_string_GLOBAL)    usb_keyboard_service_write();}
开发者ID:flabbergast,项目名称:enstix,代码行数:10,


示例15: lufaLoop

void lufaLoop(void){	if(!jennic_in_programming_mode){		CDC_Device_USBTask(&VirtualSerial_CDC0_Interface);		CDC_Arduino_In_Task();	}    do{  	  if (jennic_reset_event)  	  {  	      	    if (!jennic_in_programming_mode)  	    {  	      jennic_in_programming_mode = true;  	      Serial_Config(38400, 8, CDC_LINEENCODING_OneStopBit, CDC_PARITY_None);  	      Jennic_Set_Mode(true); /* pull jennic into programming mode */  	    }  	    else  	    {  	      jennic_in_programming_mode = false;  	      Serial_Config(1000000, 8, CDC_LINEENCODING_OneStopBit, CDC_PARITY_None);  	      Jennic_Set_Mode(false); /* pull jennic into normal mode */  	    }  	    jennic_reset_event = false;  	  }  	  //if(jennic_in_programming_mode){  	  Jennic_In_Task();  	  CDC_In_Task();  	  CDC_Device_USBTask(&VirtualSerial_CDC1_Interface);	    	  USB_USBTask();  	  /* do house-keeping */  	  	  // UDRE Interrupt enable (USART)	  // cause if our USB->USART ringbuf is full we disable the interrupt.	  if ( ringbuf_elements(&USBtoUSART_Buffer) && !(UCSR1B & (1 << UDRIE1)) )  	    UCSR1B |= (1 << UDRIE1);  	}while(jennic_in_programming_mode);}
开发者ID:pscholl,项目名称:Arduino,代码行数:42,


示例16: CDC_Device_getchar_Blocking

static int CDC_Device_getchar_Blocking(FILE* Stream){	while (!(CDC_Device_BytesReceived((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream))))	{		if (USB_DeviceState == DEVICE_STATE_Unattached)		  return _FDEV_EOF;			CDC_Device_USBTask((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream));		USB_USBTask();	}	return CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream));}
开发者ID:emcute0319,项目名称:ir-usb-kbd,代码行数:13,


示例17: 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();	/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */	CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);	sei();    DDRB  |= (1 << 4);    PORTB |= (1 << 4);	for (;;)	{        int16_t c = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);        if (c > 0){            switch (c) {                case '1':                    // this will eventually be to strobe the modem on pin of a telit module                    // set port to output mode and low state                    // stall for 1000 ms                    // set port back to high impedance                    CDC_Device_SendString(&VirtualSerial_CDC_Interface, "received 1/r/n");                    DDRD  |=  (1 << 0);                    PORTD &= ~(1 << 0);                    _delay_ms(1000);                    DDRD  &= ~(1 << 0);                    PORTD |=  (1 << 0);                    break;                case 'r':                    // this will be to strobe the reset pin of a telit module                    CDC_Device_SendString(&VirtualSerial_CDC_Interface, "received r/r/n");                    PORTB &= ~(1 << 4);                    _delay_ms(200);                    PORTB |= (1 << 4);                    break;                case '?':                    // this wil be to inquire abouth the powermon pin of a telit module                    CDC_Device_SendString(&VirtualSerial_CDC_Interface, "received ?/r/n");                    PORTB |= ~(1 << 4);                    break;                default:                    CDC_Device_SendString(&VirtualSerial_CDC_Interface, "unrecognized input/r/n");            }        }		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();	}}
开发者ID:SEL-Columbia,项目名称:modem_reset,代码行数:54,


示例18: 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();		LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);	for (;;)	{		CheckJoystickMovement();		/* Discard all received data on the first CDC interface */		while (CDC_Device_BytesReceived(&VirtualSerial1_CDC_Interface))		  CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);		/* Echo all received data on the second CDC interface */		while (CDC_Device_BytesReceived(&VirtualSerial2_CDC_Interface))		  CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface));		  		CDC_Device_USBTask(&VirtualSerial1_CDC_Interface);		CDC_Device_USBTask(&VirtualSerial2_CDC_Interface);		USB_USBTask();	}}
开发者ID:emcute0319,项目名称:ir-usb-kbd,代码行数:26,


示例19: main

int main(){  // Initialize ADC Interrupts  lastTimeInterruptLeft = avr_time_now();  lastTimeInterruptRight = avr_time_now();  out_msg.deltaUmLeft = 0;  out_msg.deltaUmRight = 0;   // Initialize ROS  nh.initNode();   nh.advertise(io_board_out);  ros::Subscriber<io_to_board> sub("to_ioboard", &ioboard_cb);  nh.subscribe(sub);  // Do timed/repeated stuff  uint32_t lastTimeOdometry = 0UL;  uint32_t lastTimeRake = 0UL;  while(1)  {    // Stop engines and raise rake, if last recieved message is older then 2s    // %TODO raise rake    if ((lastTimeMessage != 0) && (avr_time_now() - lastTimeMessage > 1000))    {       lastTimeMessage = 0;      OCR1A = 0x8000;      OCR1B = 0x8000;    }    // Publish odometry all 40ms    if (avr_time_now() - lastTimeOdometry > 40)    {      out_msg.timestamp = avr_time_now();      io_board_out.publish(&out_msg);      out_msg.deltaUmLeft = 0;      out_msg.deltaUmRight = 0;            lastTimeOdometry = avr_time_now();    }    nh.spinOnce();    // LUFA functions that need to be called frequently to keep USB alive    CDC_Device_USBTask(&Atmega32u4Hardware::VirtualSerial_CDC_Interface);    USB_USBTask();  }  return 0;}
开发者ID:asl-beachbot,项目名称:ioboard,代码行数:49,


示例20: 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();	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);	GlobalInterruptEnable();	for (;;)	{		CheckJoystickMovement();		/* Discard all received data on the first CDC interface */		CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);		/* Echo all received data on the second CDC interface */		int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface);		if (!(ReceivedByte < 0))		  CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, (uint8_t)ReceivedByte);		CDC_Device_USBTask(&VirtualSerial1_CDC_Interface);		CDC_Device_USBTask(&VirtualSerial2_CDC_Interface);		USB_USBTask();	}}
开发者ID:0tsuki,项目名称:qmk_firmware,代码行数:27,


示例21: CDC_Device_getchar_Blocking

static int CDC_Device_getchar_Blocking(FILE* Stream){	int16_t ReceivedByte;	while ((ReceivedByte = CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream))) < 0)	{		if (USB_DeviceState[corenum] == DEVICE_STATE_Unattached)		  return _FDEV_EOF;		CDC_Device_USBTask((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream));		USB_USBTask();	}	return ReceivedByte;}
开发者ID:JeremyHsiao,项目名称:TinyBlueRat_LPCv1_03,代码行数:15,


示例22: sendCDCbyte

void sendCDCbyte(uint8_t b){	//TODO improve this	// try to send until sucess	while (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, b) != ENDPOINT_READYWAIT_NoError){		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();		while (1){			// TODO remove this freezing loop!			LEDs_TurnOnLEDs(LEDS_ERR);			_delay_ms(100);			LEDs_TurnOnLEDs(LEDS_ERR);			_delay_ms(100);		}	}}
开发者ID:NicoHood,项目名称:Hoodloader,代码行数:15,


示例23: main

int main(void) {  SetupHardware();  // If digital pin 6 (PD7) is low, fill channel data with a distinctive  // pattern.  DDRD &= 0b01111111;  bool fill_with_pattern = bit_is_clear(PIND, 7);  if (fill_with_pattern) {    memset(_chandata, 0b01010101, 2048);  }  LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);  GlobalInterruptEnable();  while (true) {    CDC_Device_USBTask(&VirtualSerial_CDC_Interface);    USB_USBTask();    if (connected) {      uint8_t* position = _chandata;      int16_t universe = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);      if (universe == -1) {        // just a normal timeout, continue        continue;      }      position += universe;      while (position < _chandata + 2048) {        int16_t channel_level =            CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);        if (channel_level != -1) {          *position = (uint8_t)channel_level;          position += 4;        } else {          if (!connected) {            // connection lost, forget our position and wait for a connection            break;          }          // just a normal timeout, continue          continue;        }      }    }  }}
开发者ID:obijywk,项目名称:avrdmx,代码行数:45,


示例24: usb_thread

/* Main thread */void usb_thread (void){    for (;;)    {        bcond_wait(&usb_active);        t_yield();        int16_t c;        while ((c = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface)) > 0)            stream_put(&cdc_instr, c);        t_yield();        while ( ! stream_empty(&cdc_outstr))            CDC_Device_SendByte(&VirtualSerial_CDC_Interface, stream_get(&cdc_outstr));        CDC_Device_USBTask(&VirtualSerial_CDC_Interface);        USB_USBTask();    }}
开发者ID:PolaricTracker,项目名称:firmware,代码行数:19,


示例25: main

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();		while(1)	{		if(RTR==1)		{			if (ReceivedByte==0xFF)			{				for (uint8_t i = 0; i < 4; i++)				{					if (ReceivedByte==0)					{						ReceivedByte=1;					}					buff[i] = ReceivedByte;					RTR = 0;					while(RTR!=1){}				}				uint8_t range = ((buff[1]*256+buff[2])/100);				RingBuffer_Insert(&USARTtoUSB_Buffer,buff[1]);				RingBuffer_Insert(&USARTtoUSB_Buffer,buff[2]);				//RingBuffer_Insert(&USARTtoUSB_Buffer,range);				sendUSARTtoUSB();				_delay_ms(500);			}		}		//  		if (!RingBuffer_IsFull(&USBtoUSART_Buffer))// 		{// 			int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);// 			if (!(ReceivedByte < 0))// 			{// 				sendUSBtoUSART();// 			}			CDC_Device_USBTask(&VirtualSerial_CDC_Interface);			USB_USBTask();//		}	}}
开发者ID:ldarlok,项目名称:LCS,代码行数:44,


示例26: 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();	setupIO();	interruptInit();	/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */	CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);	sei();		while (1)	{				/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */		CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();	}}
开发者ID:DJGCrusader,项目名称:TinyArmTroller,代码行数:22,


示例27: 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();	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);	GlobalInterruptEnable();	for (;;)	{		CheckJoystickMovement();		/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */		CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		HID_Device_USBTask(&Mouse_HID_Interface);		USB_USBTask();	}}
开发者ID:UltimateHackingKeyboard,项目名称:bootloader-right,代码行数:22,


示例28: 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();	/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */	CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);	GlobalInterruptEnable();	for (;;)	{		CheckJoystickMovement();		/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */		CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);		USB_USBTask();	}}
开发者ID:0xdec,项目名称:qmk_firmware,代码行数:24,



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


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