当前位置: 首页>>代码示例>>C++>>正文


C++ USB_USBTask函数代码示例

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


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

示例1: 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);
	sei();

	for (;;)
	{
		HID_Device_USBTask(&Keyboard_HID_Interface);
		USB_USBTask();
	}
}
开发者ID:Armadill0,项目名称:CANBus-Triple_Genesis-Connect,代码行数:16,代码来源:Keyboard.c

示例2: 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 (;;)
	{
		HID_Device_USBTask(&Generic_HID_Interface);
		USB_USBTask();
	}
}
开发者ID:jledet,项目名称:lufa,代码行数:16,代码来源:GenericHID.c

示例3: main

/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
 *  runs the bootloader processing routine until it times out or is instructed to exit.
 */
int main(void)
{
	/* Save the value of the boot key memory before it is overwritten */
	uint16_t bootKeyPtrVal = *bootKeyPtr;
	*bootKeyPtr = 0;

	/* Check the reason for the reset so we can act accordingly */
	uint8_t  mcusr_state = MCUSR;		// store the initial state of the Status register
	MCUSR = 0;							// clear all reset flags	

	/* Watchdog may be configured with a 15 ms period so must disable it before going any further */
	wdt_disable();
	
	if (mcusr_state & (1<<EXTRF)) {
		// External reset -  we should continue to self-programming mode.
	} else if ((mcusr_state & (1<<PORF)) && (pgm_read_word(0) != 0xFFFF)) {		
		// After a power-on reset skip the bootloader and jump straight to sketch 
		// if one exists.	
		StartSketch();
	} else if ((mcusr_state & (1<<WDRF)) && (bootKeyPtrVal != bootKey) && (pgm_read_word(0) != 0xFFFF)) {	
		// If it looks like an "accidental" watchdog reset then start the sketch.
		StartSketch();
	}

        _delay_ms(250);
	
	/* Setup hardware required for the bootloader */
	SetupHardware();

	/* Enable global interrupts so that the USB stack can function */
	sei();
	
	Timeout = 0;
	
	while (RunBootloader)
	{
		CDC_Task();
		USB_USBTask();
		/* Time out and start the sketch if one is present */
		if (Timeout > TIMEOUT_PERIOD)
			RunBootloader = false;

		LEDPulse();
	}

	/* Disconnect from the host - USB interface will be reset later along with the AVR */
	USB_Detach();

	/* Jump to beginning of application space to run the sketch - do not reset */	
	StartSketch();
}
开发者ID:BalazsGabor92,项目名称:arduino,代码行数:54,代码来源:Caterina.c

示例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)
{
	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,代码来源:ModemReset.c

示例5: main

int
main(void) {
    MCUSR &= ~(1 << WDRF);
    wdt_disable();
    clock_prescale_set(clock_div_1);
    USB_Init();
    PORTD |= _BV(PORTD5) | _BV(PORTD6) | _BV(PORTD7);	// pull up

    sei();
    for (;;) {
        HID_Device_USBTask(&stateMachine);
        USB_USBTask();
    }
}
开发者ID:sgk,项目名称:AudioController,代码行数:14,代码来源:AudioController.c

示例6: main

int main(void) {
    hardwareInit();
    initLEDs();
    setOutputBit(&kOrangeLED, 1);

    sei();

    USB_Init();

    while (1) {
        HID_Device_USBTask(&mouseHIDInterface);
        USB_USBTask();
    }
}
开发者ID:mayoff,项目名称:mouse-latency,代码行数:14,代码来源:mouseimposter.c

示例7: main

int main(int argc, const char *argv[]) {
	clock_prescale_set(clock_div_1);
	MCUSR &= ~(1 << WDRF);
	wdt_disable();
    timer_init();
    RFID_Init();
	USB_Init();
	sei();
    while (1)
    {
        RFID_Task();
		USB_USBTask();
	}
}
开发者ID:drrk,项目名称:minimus-weigand,代码行数:14,代码来源:main.c

示例8: main

int main (void)
{
	
	uint32_t tmp_bulk_reset;
	
	MCUSR &= ~(1u << WDRF);
	wdt_disable();
	clock_prescale_set(clock_div_1);
	
	board_init();
	USB_Init();
	
	vue_write_address_full(VUE_CART_READER_nSTATUS | VUE_nROM_CE | VUE_nRAM_CS | VUE_nES);

	sei();
	
	while (true) {
	
		USB_USBTask();
		
		tmp_bulk_reset = bulk_reset;
		VUE_Task();
		
		if (tmp_bulk_reset) {
			
			/* write default state */
			VUE_CTRL->out |= VUE_nOE | VUE_nUWR | VUE_nLWR;
			VUE_CTRL->out &= ~VUE_CART_READER_PL;
			vue_write_address_full(VUE_CART_READER_nSTATUS | VUE_nROM_CE | VUE_nRAM_CS | VUE_nES);
			
			/* Reset FSM */
			cur_vue_state = IDLE;
			/* Clear Endpoints */
			Endpoint_ResetEndpoint(VUE_CART_READER_OUT_EP_ADDR);
			Endpoint_ResetEndpoint(VUE_CART_READER_IN_EP_ADDR);
			
			Endpoint_SelectEndpoint(VUE_CART_READER_OUT_EP_ADDR);
			Endpoint_ClearStall();
			Endpoint_ResetDataToggle();
			Endpoint_SelectEndpoint(VUE_CART_READER_IN_EP_ADDR);
			Endpoint_ClearStall();
			Endpoint_ResetDataToggle();
			Endpoint_AbortPendingIN();
			
			bulk_reset = 0x00000000ul;
		}
		
	}
	
}
开发者ID:Tauwasser,项目名称:VUECartReader,代码行数:50,代码来源:main.c

示例9: main

/** Main program entry point. This routine configures the hardware required by the application, then
 *  enters a loop to run the application tasks in sequence.
 */
int main(void)
{
    SetupHardware();

    puts_P(PSTR(ESC_FG_CYAN "RNDIS Host Demo running.\r\n" ESC_FG_WHITE));

    LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);

    for (;;)
    {
        RNDIS_Host_Task();
        USB_USBTask();
    }
}
开发者ID:hanshuebner,项目名称:ir-usb-kbd,代码行数:17,代码来源:RNDISEthernetHost.c

示例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();

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		MS_Device_USBTask(&Disk_MS_Interface);
		HID_Device_USBTask(&Keyboard_HID_Interface);
		USB_USBTask();
	}
}
开发者ID:DuinoPilot,项目名称:lufa,代码行数:17,代码来源:MassStorageKeyboard.c

示例11: keyboard

/** Main program entry point. This routine configures the hardware required by the application, then
 *  enters a loop to run the application tasks in sequence.
 */
char keyboard(void)
{
	char tecla;
	SetupHardwareKeyboard();

	do
	{
		tecla = KeyboardHost_Task();

		HID_Host_USBTask(&Keyboard_Host_HID_Interface);
		USB_USBTask();
	} while (tecla != 'D');
	return tecla;
}
开发者ID:TCollier92,项目名称:HAPR,代码行数:17,代码来源:KeyboardHost.c

示例12: main

/** Main program entry point. This routine configures the hardware required by the application, then
 *  enters a loop to run the application tasks in sequence.
 */
int main(void)
{
	SetupHardware();

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	GlobalInterruptEnable();

	for (;;)
	{
		Keyboard_HID_Task();
		Mouse_HID_Task();
		USB_USBTask();
	}
}
开发者ID:0xdec,项目名称:tmk_keyboard,代码行数:17,代码来源:KeyboardMouse.c

示例13: main

/** Main program entry point. This routine configures the hardware required by the application, then
 *  enters a loop to run the application tasks in sequence.
 */
int main(void)
{
	SetupHardware();

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	sei();

	for (;;)
	{
		CDC1_Task();
		CDC2_Task();
		USB_USBTask();
	}
}
开发者ID:AmesianX,项目名称:OpenPCR,代码行数:17,代码来源:DualVirtualSerial.c

示例14: 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)
{
	HidApp_Init();

	GlobalInterruptEnable();

	for (;;)
	{
		HID_Device_USBTask(&Generic_HID_Interface);
		USB_USBTask();
		Encoder_Task();
		Leds_Task();
	}
}
开发者ID:TransistorLabs,项目名称:glowproxy,代码行数:17,代码来源:HidApp.c

示例15: main

/** Main program entry point. This routine configures the hardware required by the application, then
 *  enters a loop to run the application tasks in sequence.
 */
int main(void)
{
	SetupHardware();

	puts_P(PSTR(ESC_FG_CYAN "Audio Output Host Demo running.\r\n" ESC_FG_WHITE));

	LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
	sei();

	for (;;)
	{
		USB_USBTask();
	}
}
开发者ID:hopfgarten,项目名称:jnode-atmega-dual-firmware,代码行数:17,代码来源:AudioOutputHost.c


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