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


C++ USBDeviceTasks函数代码示例

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


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

示例1: ConsoleInit

void ConsoleInit(void)
{
#if defined(ENABLE_CONSOLE)
		unsigned long i = 0;
		
		// Don't attempt anything if not connected
		if (!USB_BUS_SENSE) return;

		USBInitializeSystem();
		USBDeviceAttach();

		// This will only work in an interrupt driven USB system - exits on button press, only exits after enumeration is usb is detected
		while (USBDeviceState < CONFIGURED_STATE)
		{
			#ifndef USB_INTERRUPT
			USBDeviceTasks(); 	// Interrupt or polling method.  If using polling, must call
			#endif
			USBProcessIO();
			Delay10us(1);
			
			// Timed-out starting connection (perhaps a charger or disconnected?)
			if (i++ >= 1000000ul) 
			{ 
				// The USB connection has failed -- if we're not using the PLL when the radio is on, turn it off now
				USBDeviceDetach();
				return;
			}
		}
		

 		// Gives host time to assign CDC port
 		i = 0;
		while (USBDeviceState >= CONFIGURED_STATE && i++ < 600000ul)
		{
			MRF_LED = 1;
			#ifndef USB_INTERRUPT
			USBDeviceTasks(); 	// Interrupt or polling method.  If using polling, must call
			#endif
			USBProcessIO();
			Delay10us(10);
			if (usb_haschar())
			{
				break;
			}	
		}
		MRF_LED = 0;
#endif
	return;
}
开发者ID:12bits,项目名称:openmovement,代码行数:49,代码来源:Console.c

示例2: high_isr

void high_isr()
{
    
#if defined(USB_INTERRUPT)
        USBDeviceTasks();
#endif
}
开发者ID:TrongkhanhBkhn,项目名称:Project,代码行数:7,代码来源:main.c

示例3: main

/******************************************************************************
 * Function:        void main(void)
 *
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        Main program entry point.
 *
 * Note:            None
 *****************************************************************************/
int main(void)
{   
    InitializeSystem();

    #if defined(USB_INTERRUPT)
        USBDeviceAttach();
    #endif

    while(1)
    {
        #if defined(USB_POLLING)
		// Check bus status and service USB interrupts.
        USBDeviceTasks(); // Interrupt or polling method.  If using polling, must call
        				  // this function periodically.  This function will take care
        				  // of processing and responding to SETUP transactions 
        				  // (such as during the enumeration process when you first
        				  // plug in).  USB hosts require that USB devices should accept
        				  // and process SETUP packets in a timely fashion.  Therefore,
        				  // when using polling, this function should be called 
        				  // regularly (such as once every 1.8ms or faster** [see 
        				  // inline code comments in usb_device.c for explanation when
        				  // "or faster" applies])  In most cases, the USBDeviceTasks() 
        				  // function does not take very long to execute (ex: <100 
        				  // instruction cycles) before it returns.
        #endif
    				  

		// Application-specific tasks.
		// Application related code may be added here, or in the ProcessIO() function.
        ProcessIO();        
    }//end while
}//end main
开发者ID:iruka-,项目名称:ORANGEpico,代码行数:47,代码来源:main.c

示例4: ReadStringUART

BYTE ReadStringUART(BYTE *Dest, BYTE BufferLen)
{
	BYTE c;
	BYTE count = 0;

	if(BufferLen == 0) return 0;

	while(BufferLen--)
	{
		*Dest = '\0';

		while(!usb_haschar())
		{	
			#ifndef USB_INTERRUPT
			USBDeviceTasks(); 	// Interrupt or polling method.  If using polling, must call
			#endif
			USBProcessIO();
		}
		c = usb_getchar();

		if(c == '\r' || c == '\n')
			break;

		count++;
		*Dest++ = c;
	}

	return count;
}
开发者ID:12bits,项目名称:openmovement,代码行数:29,代码来源:CDC+UART.c

示例5: main

int main(void) {
    InitializeSystem();
    initADCDMA();

    
    #if defined(USB_INTERRUPT)
        if(USB_BUS_SENSE && (USBGetDeviceState() == DETACHED_STATE))
        {
            USBDeviceAttach();
        }
    #endif

    #if defined(USB_POLLING)
            // Check bus status and service USB interrupts.
            USBDeviceTasks();
    #endif
    while(1)
    {
        if (!ADC_DATA_READY)
            continue;
                
        ADC_DATA_READY = 0;
        
        RunFFT();

        putrsUSBUSART((char*)&fftOut[0].real);
        
        ProcessIO();
    }
    return (EXIT_SUCCESS);
}
开发者ID:PeterLaiCCIT,项目名称:regis,代码行数:31,代码来源:main.c

示例6: ISRCode

void interrupt ISRCode()
{
    //if(RCIF)
    if(IOCBF)
        ResultRx();
    //if(TMR0IF)
    //    WorkTick();
    //if(RCIF)
    //    ResultRx();
    //if(TMR1GIF)
    //    UpdateFanSpeed();
    /*if(BCL1IF) {
        BCL1IF = 0; I2CState.Next = 0;
    }
    if(SSP1IF) {
        SSP1IF = 0;
        if(I2CState.Slave)
            I2CSlave();
        else if(I2CState.Next < I2C_WRITE) // split because not enough contigous code space
            I2CRead();
        else
            I2CWrite();
    }*/
    #if defined(USB_INTERRUPT)
        USBDeviceTasks();
    #endif
}
开发者ID:Bicknellski,项目名称:klondike,代码行数:27,代码来源:main.c

示例7: main

int main(void){   
	unsigned long timer;
	#define longDelay(x) timer=x; while(timer--)
    CLKDIV = 0x0000;    // Set PLL prescaler (1:1)
    init();			//setup the crystal, pins, hold the FPGA in reset
	usbbufflush();	//setup the USB byte buffer
	

    USBDeviceInit();//setup usb

    while(1){
        USBDeviceTasks(); 

    	if((USBDeviceState < CONFIGURED_STATE)||(USBSuspendControl==1)) continue;
		usbbufservice();//load any USB data into byte buffer

			//send data from the FPGA receive buffer to USB
			//if((mUSBUSARTIsTxTrfReady()) && (uartincnt > 0)){
			//	putUSBUSART(&buf[0], uartincnt);
			//}

    	CDCTxService();

    }//end while

}//end main
开发者ID:jevinskie,项目名称:bus-pirate-old,代码行数:26,代码来源:main.c

示例8: BinaryMemoryUpload

/*****************************************************************************
 * void BinaryMemoryUpload(void)
 *****************************************************************************/
void BinaryMemoryUpload(void)
{
    #ifdef USE_COMM_PKT_MEDIA_USB
    #if defined(USB_INTERRUPT)
        USBDeviceAttach();
    #endif
    #endif

    COMM_PKT_Init();

    while(!BinaryHandlePacket())
    {
        COMM_PKT_Update(FLASH_PROGRAMMER_COMMUNICATION_MEDIUM);

        #ifdef USE_COMM_PKT_MEDIA_USB
        #if defined(USB_POLLING)
		// Check bus status and service USB interrupts.
        USBDeviceTasks(); // Interrupt or polling method.  If using polling, must call
        				  // this function periodically.  This function will take care
        				  // of processing and responding to SETUP transactions 
        				  // (such as during the enumeration process when you first
        				  // plug in).  USB hosts require that USB devices should accept
        				  // and process SETUP packets in a timely fashion.  Therefore,
        				  // when using polling, this function should be called 
        				  // regularly (such as once every 1.8ms or faster** [see 
        				  // inline code comments in usb_device.c for explanation when
        				  // "or faster" applies])  In most cases, the USBDeviceTasks() 
        				  // function does not take very long to execute (ex: <100 
        				  // instruction cycles) before it returns.
        #endif
        #endif
    }
}
开发者ID:Athuli7,项目名称:Microchip,代码行数:36,代码来源:FlashProgrammer.c

示例9: INTERRUPT_InterruptManager

void interrupt INTERRUPT_InterruptManager (void)
{
   // interrupt handler
    if(PIE1bits.TMR1IE == 1 && PIR1bits.TMR1IF == 1)
    {
        TMR1_ISR();
        // Call Timer Handler
        TMRapp_Tick();      // Handle Every mS
    }
    else if( (PIE1bits.RCIE == 1) && (PIR1bits.RCIF == 1) )
    {
        USBapp_setrxByteFlag();
        EUSART_Receive_ISR();
    }
    else if( (PIE1bits.TXIE == 1) && (PIR1bits.TXIF == 1) )
    {
        EUSART_Transmit_ISR();
    }
    else if(PIE2bits.C1IE == 1 && PIR2bits.C1IF == 1)
    {
        CMP1_ISR();
    }
    else
    {
        //Unhandled Interrupt
        USBDeviceTasks(); // USB things
    }
}
开发者ID:chrismerck,项目名称:scriptr_iotx_demo_fw,代码行数:28,代码来源:interrupt_manager.c

示例10: highPrioISR

void highPrioISR(void)
{
#if defined(USB_INTERRUPT)
    /* if (PIR2bits.USBIF) */
        USBDeviceTasks();
#endif
}	//This return will be a "retfie fast", since this is in a #pragma interrupt section
开发者ID:niamster,项目名称:uc-pic,代码行数:7,代码来源:main.c

示例11: DelayMs

void  DelayMs(uint16_t time)
{
    uint16_t delay;

    //Caller wants to block for a possibly very long time.  If USB is enabled
    //and operated in polling mode, we must call USBDeviceTasks() periodically
    //so we can still process mandatory USB control transfer requests from the
    //host within the time allowed by the USB specs.
    #if defined(USB_POLLING)
        if(U1CONbits.USBEN == 1)
        {
            while(time--)
            {
                for(delay=0; delay < 240u; delay++)
                {
                    USBDeviceTasks();   //Assuming 50 inst cycles/call @ 12 MIPS = ~240 calls/ms
                }
            }
        }
		else
		{
            while(time--)
            {
                for(delay=0; delay<DELAY_1MS; delay++);
            }		
		}
    #else
        while(time--)
        {
            for(delay=0; delay<DELAY_1MS; delay++);
        }
    #endif
}
开发者ID:timwuu,项目名称:PK3SP24,代码行数:33,代码来源:oled.c

示例12: main

// Main program entry point
void main(void)
{   
	// Initialise and configure the PIC ready to go
    initialisePic();



	// If we are running in interrupt mode attempt to attach the USB device
    #if defined(USB_INTERRUPT)
        USBDeviceAttach();
    #endif
	

	// Main processing loop
    while(1)
    {
        #if defined(USB_POLLING)
			// If we are in polling mode the USB device tasks must be processed here
			// (otherwise the interrupt is performing this task)
	        USBDeviceTasks();
        #endif
    	
    	// Process USB Commands
        processUsbCommands();  
        
        // Note: Other application specific actions can be placed here      
    }
}
开发者ID:ADTL,项目名称:PNPControllerUSB,代码行数:29,代码来源:main.c

示例13: main

/********************************************************************
 * Function:        void main(void)
 *
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        Main program entry point.
 *
 * Note:            None
 *******************************************************************/
MAIN_RETURN main(void)
{
    SYSTEM_Initialize(SYSTEM_STATE_USB_START);

    USBDeviceInit();
    USBDeviceAttach();
    setup();

    while(1)
    {
        SYSTEM_Tasks();

        #if defined(USB_POLLING)
            // Interrupt or polling method.  If using polling, must call
            // this function periodically.  This function will take care
            // of processing and responding to SETUP transactions
            // (such as during the enumeration process when you first
            // plug in).  USB hosts require that USB devices should accept
            // and process SETUP packets in a timely fashion.  Therefore,
            // when using polling, this function should be called
            // regularly (such as once every 1.8ms or faster** [see
            // inline code comments in usb_device.c for explanation when
            // "or faster" applies])  In most cases, the USBDeviceTasks()
            // function does not take very long to execute (ex: <100
            // instruction cycles) before it returns.
            USBDeviceTasks();
        #endif

        //Application specific tasks
        APP_DeviceCDCBasicDemoTasks();

    }//end while
}//end main
开发者ID:ikesato,项目名称:usb_shock_buzzer,代码行数:48,代码来源:main.c

示例14: main

int main(void) {
    InitializeSystem();

    // Wait for reset button to be released
    while (_PORT(PIO_BTN1) == HIGH) { }

    //ADCInitialize();
    PWMInitialize();
    PWMEnable();
    USBDeviceInit();

    //ADCStartCapture();
    _LAT(PIO_LED1) = HIGH;

    ColourEngine::Initialize();
    //ColourEngine::PowerOn(1000); // Fade in
    ColourEngine::SetPower(power, 0);

    //_LAT(PIO_LED2) = HIGH;

    while (1) {
        USBDeviceTasks();
        USBUserProcess();
    }

    return 0;
}
开发者ID:jorticus,项目名称:hexlight-firmware,代码行数:27,代码来源:main.cpp

示例15: main

int main(void)
#endif
{
    InitializeSystem();

#if defined(USB_INTERRUPT)
    USBDeviceAttach();
#endif

    while(1)
    {
#if defined(USB_POLLING)
        // Check bus status and service USB interrupts.
        USBDeviceTasks(); // Interrupt or polling method.  If using polling, must call
        // this function periodically.  This function will take care
        // of processing and responding to SETUP transactions
        // (such as during the enumeration process when you first
        // plug in).  USB hosts require that USB devices should accept
        // and process SETUP packets in a timely fashion.  Therefore,
        // when using polling, this function should be called
        // frequently (such as once about every 100 microseconds) at any
        // time that a SETUP packet might reasonably be expected to
        // be sent by the host to your device.  In most cases, the
        // USBDeviceTasks() function does not take very long to
        // execute (~50 instruction cycles) before it returns.
#endif


        // Application-specific tasks.
        // Application related code may be added here, or in the ProcessIO() function.
        ProcessIO();
    }//end while
}//end main
开发者ID:pimplod,项目名称:PIC-USB-Programmer,代码行数:33,代码来源:main.c


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