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

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

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

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

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

示例1: main

int main(void){	uchar   i = 1;	uchar	hidCurrentMode = 255;	char remainingData=0;	uchar offset=0;	HardwareInit();	usbInit();	// Set up descriptor	hidMode = HIDM_1P;	ReadController(1);	SetHIDMode();    for(;;){                /* main event loop */        usbPoll();        if(usbInterruptIsReady()){            /* called after every poll of the interrupt endpoint */			ReadController(i);			RemapButtons(&(reportBuffer.b1), &(reportBuffer.b2));			RemapButtons(&(reportBufferWheel.b1), &(reportBufferWheel.b2));			remainingData=reportBufferLength;			offset=0;			// handle report with more than 8 byte length (for NegCon and future expansion)			do {				if (remainingData<=8) {					usbSetInterrupt(reportBufferAddress+offset, remainingData);					remainingData=0;				}				else {						usbSetInterrupt(reportBufferAddress+offset, 8);									offset+=8;					remainingData-=8;					do {						usbPoll();					} while (!usbInterruptIsReady());					}			} while (remainingData>0);											i++;			if (i > hidNumReports) i = 1;			if (hidCurrentMode != hidMode)			{				SetHIDMode();				hidCurrentMode = hidMode;			}        }    }    return 0;}
开发者ID:gaggi,项目名称:RetroAdapterMod,代码行数:52,


示例2: _init_rf_network

void USB_DEVICE::run_usb(){	//! Sets up the rf network	_init_rf_network();	_setup_usb_report_params();	/**	 * Once the state machine gets here, it polls for data from the router	 * and parses it into the structures.	 */	for(;;){		//! Poll the USB Line		usbPoll();		//! Check to see if a report needs to be sent, using		//! the idle rate.		if ((TCNT1 > ((4 * (F_CPU / 1024000)) * idle_rate)				|| TCNT1 > 0x7FFF) && idle_rate != 0) {			//! Needs to send			_sending_mutex = true;		}else{			//! Create a valid random USB Frame			_create_usb_report_frame();		}		//! Poll the USB Line		usbPoll();		//! If we need to send.		if(_sending_mutex){			//! Send the report.			//! and reset the timer.			_send_usb_report_frame();			TCNT1 = 0;		}		//! Poll the USB line		usbPoll();		//! No need to send anymore.		_sending_mutex = false;	}}
开发者ID:CaptFrank,项目名称:Black-Box-Mouse-Interface,代码行数:49,


示例3: main

int main( void ){	//===========================================	uchar   calibrationValue;    calibrationValue = eeprom_read_byte(0); /* calibration value from last time */    if(calibrationValue != 0xff){        OSCCAL = calibrationValue;    }	//===========================================	usbInit();    wdt_enable(WDTO_1S);    /* Даже если Вы не используете сторожевой таймер (watchdog), выключите его здесь. На более новых     *  микроконтроллерах состояние watchdog (вкл/выкл, период) СОХРАНЯЕТСЯ ЧЕРЕЗ СБРОС!     */	//===========================================    usbDeviceDisconnect();    _delay_ms(300);			/* 300 ms disconnect */    usbDeviceConnect();	//===========================================    //LED_PORT_DDR |= _BV(LED_BIT);		/* делаем ножку, куда подключен LED, выходом */	sbi(LED_PORT_DDR,LED_BIT);			/* делаем ножку, куда подключен LED, выходом */	//===========================================	sei();		/* Разрешаем прерывания*/    for(;;){    /* main event loop */        wdt_reset();        usbPoll();	}	//===========================================}
开发者ID:aBaTaPbl4,项目名称:BuildOrb2,代码行数:29,


示例4: main

/**************************************************************************************Function Name 		:	mainDescription			:	Initialize the USB and start the interruptParameters 			:	voidReturn 				:	int **************************************************************************************/int main(void){	uchar l_delayCount;    wdt_enable(WDTO_1S);    odDebugInit();    DBG1(0x00, 0, 0);       /* debug output: main starts */    usbInit();    usbDeviceDisconnect();  /* enforce re-enumeration,     						   do this while interrupts are disabled! */    l_delayCount = 0;    while(--l_delayCount)    {                 	/* fake USB disconnect for > 250 ms */        wdt_reset();        _delay_ms(1);    }    usbDeviceConnect();    sei();    DBG1(0x01, 0, 0);           for(;;)    {                        DBG1(0x02, 0, 0);   /*debug output: main loop iterates*/        wdt_reset();        usbPoll();    }    return 0;}
开发者ID:SripaulJeevendiran,项目名称:pam-password-vusb,代码行数:33,


示例5: main

int main() {    uchar i;    DDRB = 1; // LED is on PB0    // set up a 1 second watchdog timer that resets the microcontroller    // if 1000 milliseconds pass without a call to wdt_reset()    wdt_enable(WDTO_1S);    // init v-usb    usbInit();    usbDeviceDisconnect(); // enforce re-enumeration    for(i = 0; i < 250; i++) { // wait 500 ms        wdt_reset(); // keep the watchdog happy        _delay_ms(2);    }    usbDeviceConnect();    sei(); // Enable interrupts after re-enumeration    while(1) {        wdt_reset(); // keep the watchdog happy        usbPoll();    }    return 0;}
开发者ID:2m,项目名称:avr-projects,代码行数:28,


示例6: main

//Main routineint main(void) {    int d;    uint16_t v;        // cli();    initio();    inittxt();    usbInit();    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */    uint8_t i = 0;    while(--i){             /* fake USB disconnect for > 250 ms */        _delay_ms(1);    }    usbDeviceConnect();        sei();    //Go display stuff    while(1) {	for (d=0; d<11; d++) {	    v=getcharat(d);	    setvfd(d,v);	    _delay_ms(1);	    handlepwm();	    usbPoll();	}	    }}
开发者ID:ceemos,项目名称:vfd-fv651g,代码行数:31,


示例7: main

int main(void){uchar   i;    wdt_enable(WDTO_1S);    /* Если не используется watchdog, отключите эту строчку. Для новых устройств        статус watchdog (on/off, period) СОХРАНЯЕТСЯ ПОСЛЕ СБРОСА!     */    /* Статус RESET: все ножки портов в режиме ввода без нагрузочных резисторов (pull-up).        Это то, что нужно для D+ and D-, таким образом, мы не нуждаемся в дополнительной аппаратной        инициализации.     */    usbInit();              // см. usbdrv.h и usbdrv.c    usbDeviceDisconnect();  /* см. usbdrv.h - запускает реэнумерацию, делаем это, пока отключены прерывания! */    i = 0;    while(--i)    {            /* подделывам USB disconnect на время > 250 ms */        wdt_reset();        _delay_ms(1);    }    usbDeviceConnect();     // см. usbdrv.h    LED_PORT_DDR |= _BV(LED_BIT);   /* переключаем ножку LED в режим вывода */    sei();    for(;;){                /* главный цикл события */        wdt_reset();        usbPoll();    }    return 0;}
开发者ID:aBaTaPbl4,项目名称:BuildOrb2,代码行数:29,


示例8: memset

const char *requestPin(PinMatrixRequestType type, const char *text){	PinMatrixRequest resp;	memset(&resp, 0, sizeof(PinMatrixRequest));	resp.has_type = true;	resp.type = type;	usbTiny(1);	msg_write(MessageType_MessageType_PinMatrixRequest, &resp);	pinmatrix_start(text);	for (;;) {		usbPoll();		if (msg_tiny_id == MessageType_MessageType_PinMatrixAck) {			msg_tiny_id = 0xFFFF;			PinMatrixAck *pma = (PinMatrixAck *)msg_tiny;			pinmatrix_done(pma->pin); // convert via pinmatrix			usbTiny(0);			return pma->pin;		}		if (msg_tiny_id == MessageType_MessageType_Cancel || msg_tiny_id == MessageType_MessageType_Initialize) {			pinmatrix_done(0);			if (msg_tiny_id == MessageType_MessageType_Initialize) {				protectAbortedByInitialize = true;			}			msg_tiny_id = 0xFFFF;			usbTiny(0);			return 0;		}#if DEBUG_LINK		if (msg_tiny_id == MessageType_MessageType_DebugLinkGetState) {			msg_tiny_id = 0xFFFF;			fsm_msgDebugLinkGetState((DebugLinkGetState *)msg_tiny);		}#endif	}}
开发者ID:ondrejsika,项目名称:trezor-mcu,代码行数:35,


示例9: main

int main(void){    led_init();        sht1x_init();    //sser_init();        wdt_enable(WDTO_1S);        /* Even if you don't use the watchdog, turn it off here. On newer devices,     * the status of the watchdog (on/off, period) is PRESERVED OVER RESET!     */    /* RESET status: all port bits are inputs without pull-up.     * That's the way we need D+ and D-. Therefore we don't need any     * additional hardware initialization.     */    odDebugInit();    DBG1(0x00, 0, 0);       /* debug output: main starts */    usbInit();    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */    unsigned char i = 0;    while(--i){             /* fake USB disconnect for > 250 ms */        wdt_reset();        _delay_ms(1);    }    usbDeviceConnect();    sei();    DBG1(0x01, 0, 0);       /* debug output: main loop starts */            for(;;){        wdt_reset();        usbPoll();    }    return 0;   /* never reached */}
开发者ID:baracudaz,项目名称:usb-sht,代码行数:32,


示例10: __attribute__

int __attribute__((noreturn)) main(void){    bootLoaderInit();    initStatusLed();    if (bootLoaderCondition()) {        if (eeprom_read_stay_in_bootloader() != 0)            eeprom_clear_stay_in_bootloader();        statusLedOn();        uchar i = 0, j = 0;        GICR = (1 << IVCE); /* enable change of interrupt vectors */        GICR = (1 << IVSEL); /* move interrupts to boot flash section */        initForUsbConnectivity();        for (;;) { /* main event loop */            wdt_reset();            usbPoll();#if BOOTLOADER_CAN_EXIT            if (exitMainloop) {                if (--i == 0) {                    if (--j == 0)                        break;                }            }#endif        }    }    leaveBootloader();}
开发者ID:ejholmes,项目名称:openfocus,代码行数:31,


示例11: main

int main() {	initLCD();	LCD_goto(1,0);	lcd_puts("AVRLCD 4bit mode");        uchar i;		  DDRB = 1; // PB0 as output    wdt_enable(WDTO_1S); // enable 1s watchdog timer    usbInit();            usbDeviceDisconnect(); // enforce re-enumeration    for(i = 0; i<250; i++) { // wait 500 ms        wdt_reset(); // keep the watchdog happy        _delay_ms(2);    }    usbDeviceConnect();            sei(); // Enable interrupts after re-enumeration            while(1) {        wdt_reset(); // keep the watchdog happy        usbPoll();    }            return 0;}
开发者ID:manoja328,项目名称:myavr,代码行数:26,


示例12: main

int main( void ){	usbInit();	sei();		init_joy();		for ( ;; )	{		usbPoll();				// Don't bother reading joy if previous changes haven't gone out yet.		// Forces delay after changes which serves to debounce controller as well.		if ( usbInterruptIsReady() )		{			read_joy();						// Don't send update unless joystick changed			if ( memcmp( report_out, report, sizeof report ) )			{				memcpy( report_out, report, sizeof report );				usbSetInterrupt( report_out, sizeof report_out );				toggle_led();			}		}	}		return 0;}
开发者ID:gblargg,项目名称:vusb-joystick,代码行数:29,


示例13: __attribute__

void __attribute__((noreturn)) main( void ){    cli();    initLeds();    wdt_enable( WDTO_1S );    // USB initialization.    usbInit();    usbDeviceDisconnect();  // enforce re-enumeration, do this while interrupts are disabled!    unsigned char b = 150;    while ( b-- )    {        _delay_ms( 1 );        wdt_reset();    }    cpuIoInit();    usbDeviceConnect();    sei();    for ( ;; )    {        // main event loop        usbPoll();        wdt_reset();        cpuIoPoll();        //_delay_ms( 10 );    }}
开发者ID:z80,项目名称:avrusb,代码行数:30,


示例14: vusb_poll

bool vusb_poll(void){	usbPoll();	bool ret_val = false;		// take care of the idle rate	if (vusb_idle_rate  &&  (TIFR0  &  _BV(TOV0)))		// timer overflow?	{		TIFR0 = _BV(TOV0);		if (vusb_idle_rate != 0)		{			if (vusb_idle_counter > 4)			{				vusb_idle_counter -= 5;	// 22 ms in units of 4 ms			} else {				vusb_idle_counter = vusb_idle_rate;				ret_val = true;			}		}	}		return ret_val;}
开发者ID:jthen,项目名称:7g-wireless,代码行数:25,


示例15: sendPS3Data

void sendPS3Data(dataForController data){/* The data being transferred is in the following format:	byte0 - 8 buttons ( bit0...bit7 =				[blue][green][red][yellow][orange][star power][is higher frets][unused]	byte1 - 5 buttons, 3bits padding bit0...bit7 = 				[select][start][??][??],[ps3 button],[pad][pad][pad]	byte2 - hat switch 			0000 N, 0001 N/E, 0010 E, 0011 SE, 0100 S, 0101 SW, 0110 W, 0111, NW, 1000, nothing pressed	byte3 - x axis (unused)	byte4 - y axis (unused)	byte5 - z axis (Whammy Bar)	byte6 - rzaxis (Choose solo style)*/       //set the buttons to all at default positions        reportBuffer[0] = 0b00000000;        reportBuffer[1] = 0b00000000;        reportBuffer[2] = 0b00001000;        reportBuffer[3] = 0b10000000;        reportBuffer[4] = 0b10000000;        reportBuffer[5] = 0b10000000;        reportBuffer[6] = 0b00000000;        // Since 'colorOn' is 1 when a fret is pressed, we shift it to the proper place and | it to set the        // corresponding button bit to one, which corresponds to a button press.        reportBuffer[0] |= (data.orangeOn << ORANGE_BIT);        reportBuffer[0] |= (data.blueOn << BLUE_BIT);        reportBuffer[0] |= (data.yellowOn << YELLOW_BIT);        reportBuffer[0] |= (data.redOn << RED_BIT);        reportBuffer[0] |= (data.greenOn << GREEN_BIT);        // On the PS3, the strumming shows up as a hat switch, so we have to use conditionals for this..        if (data.upOn)                reportBuffer[2] = 0b00000000;        if (data.downOn)                reportBuffer[2] = 0b00000100;		// Now set the whammy bar data		reportBuffer[5] = data.numberOfStringsPressed;		//Finally, Start, Star Power, and the Home button (not working yet)		reportBuffer[1] |= (data.plusOn << PLUS_BIT);        reportBuffer[0] |= (data.minusOn << MINUS_BIT);		reportBuffer[1] |= (data.homeOn << HOME_BIT);        //Then we finish off some USB stuff.        wdt_reset();  //Reset the watchdog timer        usbPoll();    //USB poll - must be called at least once per 10ms        // Now, regardless of mode, we have to send the data to the         // USB controlling library from the buffer we've been building        if(usbInterruptIsReady())        {            /* called after every poll of the interrupt endpoint */            usbSetInterrupt((void *)&reportBuffer, sizeof(reportBuffer));        }                }
开发者ID:RecklessJ,项目名称:openchord-guitar,代码行数:60,


示例16: main

int main(void){    uchar i;    wdt_enable(WDTO_1S);    wdt_disable();    usbInit();    usbDeviceDisconnect();    i = 0;    while(--i){        wdt_reset();        _delay_ms(1);    }	    _delay_ms(250);    usbDeviceConnect();    sei();    for(;;){        //wdt_reset();        usbPoll();    }    return 0;}
开发者ID:imsplitbit,项目名称:avr_work,代码行数:28,


示例17: wait_usb_interrupt

static void wait_usb_interrupt( void ){	#if AUTO_OSCCAL		// don't wait for interrupt until calibrated		if ( osc_not_calibrated )			goto handled;	#endif		// Clear any stale pending interrupt, then wait for interrupt flag	USB_INTR_PENDING = 1<<USB_INTR_PENDING_BIT;	while ( !(USB_INTR_PENDING & (1<<USB_INTR_PENDING_BIT)) )		wdt_reset();		for ( ;; )	{		// Vector interrupt manually		USB_INTR_PENDING = 1<<USB_INTR_PENDING_BIT;		USB_INTR_VECTOR();				// Wait a little while longer in case another one comes		uchar n = 250; // about 90us timeout		do {			if ( !--n )				goto handled;		}		while ( !(USB_INTR_PENDING & (1<<USB_INTR_PENDING_BIT)) );	}handled:		usbPoll();}
开发者ID:gblargg,项目名称:micronucleus,代码行数:31,


示例18: main

int main(){	fabscan_setup();	uchar i;//    wdt_enable(WDTO_1S); // enable 1s watchdog timer    usbInit();    usbDeviceDisconnect(); // enforce re-enumeration    for(i = 0; i<250; i++) { // wait 500 ms//        wdt_reset(); // keep the watchdog happy        _delay_ms(2);    }    usbDeviceConnect();    sei(); // Enable interrupts after re-enumeration    while(1)    {//    		wdt_reset(); // keep the watchdog happy    		usbPoll();    		if(fab_work_flag)	// if there is new data for fabscan → let it work    		{    			fab_work_flag=0;    			fabscan_work(1,incomingByte);    		}    }    return 0;}
开发者ID:pholat,项目名称:FabScan_USB_brd,代码行数:27,


示例19: __attribute__

int __attribute__((noreturn)) main(void){uchar   i;    wdt_enable(WDTO_1S);    /* Even if you don't use the watchdog, turn it off here. On newer devices,     * the status of the watchdog (on/off, period) is PRESERVED OVER RESET!     */    /* RESET status: all port bits are inputs without pull-up.     * That's the way we need D+ and D-. Therefore we don't need any     * additional hardware initialization.     */    odDebugInit();    usbInit();    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */    i = 0;    while(--i){             /* fake USB disconnect for > 250 ms */        wdt_reset();        _delay_ms(1);    }    usbDeviceConnect();    sei();    DDRB |= _BV(PB0);    for(;;){                /* main event loop */        wdt_reset();        usbPoll();        if (eeprom_read_byte(10) == 1) {          PORTB |= _BV(PB0);        } else {          PORTB &= ~_BV(PB0);        }    }}
开发者ID:deanmao,项目名称:laptop_alarm,代码行数:33,


示例20: main

int main(void) {	wdt_enable(WDTO_1S);  initPodControls();	/* Even if you don't use the watchdog, turn it off here. On newer devices,	 * the status of the watchdog (on/off, period) is PRESERVED OVER RESET!	 */	/* RESET status: all port bits are inputs without pull-up.	 * That's the way we need D+ and D-. Therefore we don't need any	 * additional hardware initialization.	 */	usbInit();	usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */	uchar i = 0;	while(--i){             /* fake USB disconnect for > 250 ms */			wdt_reset();			_delay_ms(1);	}	usbDeviceConnect();	sei();	for(;;){                /* main event loop */			wdt_reset();			usbPoll();			if(usbInterruptIsReady()){				/* called after every poll of the interrupt endpoint */				usbSetInterrupt((void *)&reportBuffer, sizeof(reportBuffer));			} else {				updateSensorData();        updateLEDState();      }	}}
开发者ID:eldstal,项目名称:avr-pod,代码行数:33,


示例21: main

int main(void) {    wdt_enable(WDTO_1S);  // watchdog status is preserved on reset    hardwareInit();    usbInit();    usbDeviceDisconnect();    // fake USB disconnect for > 250 ms    for( uint8_t i=255; i>0; i-- ) {        wdt_reset();        _delay_ms(1);    }    usbDeviceConnect();    sei();    for(;;) {               // main event loop        wdt_reset();        usbPoll();    }    return 0;}
开发者ID:Lords08,项目名称:alanarduinotools,代码行数:25,


示例22: main

int main(void){    extern uchar usbNewDeviceAddr;    uint8_t i;//Reconnect USB    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */    i = 0;    while(--i)        _delay_ms(2);    usbDeviceConnect();    usbInit();    sei();    leds[LED_RED].frequency = LED_ON;    LED_init();    for (i=0; i<3; i++)        TIMER_delay(250);    leds[LED_RED].frequency = LED_OFF;    leds[LED_GREEN].frequency = 1;    while(1)    {        if (TIMER_timeout == 0)        {            if(usbNewDeviceAddr)                leds[LED_BLUE].frequency = LED_ON;            PORTD ^= (1<<PD7);            TIMER_start(1);            usbPoll();            LED_poll();        }    }}
开发者ID:alexbrickwedde,项目名称:floodping,代码行数:34,


示例23: main

int main(void){    wdt_enable(WDTO_1S);    odDebugInit();    hardwareInit();    usbInit();    intr3Status = 0;    sendEmptyFrame  = 0;    sei();    for(;;){    /* main event loop */        wdt_reset();        usbPoll();        uartPoll();#if USB_CFG_HAVE_INTRIN_ENDPOINT3        /* We need to report rx and tx carrier after open attempt */        if(intr3Status != 0 && usbInterruptIsReady3()){            static uchar serialStateNotification[10] = {0xa1, 0x20, 0, 0, 0, 0, 2, 0, 3, 0};            if(intr3Status == 2){                usbSetInterrupt3(serialStateNotification, 8);            }else{                usbSetInterrupt3(serialStateNotification+8, 2);            }            intr3Status--;        }#endif    }    return 0;}
开发者ID:AkashGutha,项目名称:avr,代码行数:34,


示例24: __attribute__

int __attribute__((noreturn)) main(void) {    /* initialize hardware */    bootLoaderInit();    odDebugInit();    DBG1(0x00, 0, 0);    /* jump to application if jumper is set */    if(bootLoaderCondition()) {        uchar i = 0, j = 0;#ifndef TEST_MODE        GICR = (1 << IVCE);  /* enable change of interrupt vectors */        GICR = (1 << IVSEL); /* move interrupts to boot flash section */#endif        initForUsbConnectivity();        do { /* main event loop */            wdt_reset();            usbPoll();#if BOOTLOADER_CAN_EXIT            if(exitMainloop) {#if F_CPU == 12800000                break;  /* memory is tight at 12.8 MHz, save exit delay below */#endif                if(--i == 0) {                    if(--j == 0)                        break;                }            }#endif        } while(bootLoaderCondition());    }    leaveBootloader();}
开发者ID:agural,项目名称:Photuris,代码行数:31,


示例25: main

int main(void){uchar   i;    wdt_enable(WDTO_1S);    /* Even if you don't use the watchdog, turn it off here. On newer devices,     * the status of the watchdog (on/off, period) is PRESERVED OVER RESET!     */    DBG1(0x00, 0, 0);       /* debug output: main starts */    /* RESET status: all port bits are inputs without pull-up.     * That's the way we need D+ and D-. Therefore we don't need any     * additional hardware initialization.     */    odDebugInit();    usbInit();    usbDeviceDisconnect();  /* enforce re-enumeration, do this while interrupts are disabled! */    i = 0;    while(--i){             /* fake USB disconnect for > 250 ms */        wdt_reset();        _delay_ms(1);    }    usbDeviceConnect();    LED_PORT_DDR |= _BV(LED_BIT);   /* make the LED bit an output */    sei();    DBG1(0x01, 0, 0);       /* debug output: main loop starts */    for(;;){                /* main event loop */        DBG1(0x02, 0, 0);   /* debug output: main loop iterates */        wdt_reset();        usbPoll();    }    return 0;}
开发者ID:elcerdo,项目名称:avr,代码行数:32,


示例26: main

// mainint main(void) {		wdt_enable(WDTO_1S);	hardwareInit();	usbInit();	sei();		unsigned int adcValue,replymask,replyshift,replybyte;		while(1) {		uchar i = 0;		wdt_reset();		usbPoll();		PORTD ^= (1 << 6);				//jump to bootloader if jumper is HIGH		if(bit_is_clear(PIND, 5)) {			startBootloader();		}				for(i = 0; i < ADC_CHANNELS; i++) {			//adcValue = adc_read(ADC_PRESCALER_32, ADC_VREF_AVCC, i);			adcValue = i;			usb_reply[i] = adcValue >> 2;				replybyte = 16 + (i / 4);			replyshift = ((i % 4) * 2);			replymask = (3 << replyshift);			usb_reply[replybyte] =	(usb_reply[replybyte] & ~replymask) | (replymask & (adcValue << replyshift));			_delay_us(ADCDELAY);		}		usb_reply[20] = PINC;	}	return 0;}
开发者ID:patricksebastien,项目名称:hicu,代码行数:35,


示例27: main

int main(void){    wdt_reset();    wdt_enable(WDTO_120MS);    usbInit();    usbDeviceDisconnect();    uint8_t t;    for (t=255; t; t--) {        _delay_ms(1);        wdt_reset();    }    usbDeviceConnect();    sei();    gpib_init();    for (;;) {        usbPoll();        wdt_reset();    }}
开发者ID:themadinventor,项目名称:ful488,代码行数:25,


示例28: main

int main(void) {	uchar i, j;	/* no pullups on USB and ISP pins */	//PORTD = 0;	//PORTB = 0;	/* all outputs except PD2 = INT0 */	/// LB - different pins on STK500 board	//DDRD = ~(1 << 2);	// make JTAG pins inputs with pullups		SET_JTAG_PULLUPS();	/* output SE0 for USB reset */	/// LB - different pins on STK500 board	//DDRB = ~0;	j = 0;	/* USB Reset by device only required on Watchdog Reset */	while (--j) {		i = 0;		/* delay >10ms for USB reset */		while (--i)			;	}	/* all USB and ISP pins inputs */	//DDRB = 0;	/// LB - LED pins are different from usbasp to sp duo - conflict: SP duo uses these for JTAG	/* all inputs except PC0, PC1 */	//DDRC = 0x03;	//PORTC = 0xfe;	SET_LED_OUTPUT();	LED_OFF();	/* init timer */	clockInit();	#ifdef UART_DEBUG    // init debug uart    setupUART();    TransmitString("/r/n/n***/r/nstarting up/r/n");#endif		// USB Re-Enumeration	usbDeviceDisconnect();	while(--i){         // fake USB disconnect for > 250 ms	    wdt_reset();    // if watchdog is active, reset it	    _delay_ms(1);   // library call -- has limited range	}	usbDeviceConnect();	/* main event loop */	usbInit();	sei();	for (;;) {		usbPoll();	}	return 0;}
开发者ID:Duality4Y,项目名称:tinyJTAG,代码行数:60,


示例29: main

int main(){	uchar i;	DDRB |= 1; // PB0 as output	DDRB |= (1<<1); // PB1 as output    wdt_enable(WDTO_1S); // enable 1s watchdog timer    usbInit();            usbDeviceDisconnect(); // enforce re-enumeration    for(i = 0; i<250; i++) // wait 500 ms	{         wdt_reset(); // keep the watchdog happy        _delay_ms(2);    }    usbDeviceConnect();            sei(); // Enable interrupts after re-enumeration     	PORTB |= (1<<1); // PB1 on	     while(1)	{		        wdt_reset(); // keep the watchdog happy        usbPoll();    }            return 0;}
开发者ID:krzysztofwalach,项目名称:SomethingsWrong,代码行数:31,


示例30: AVRISP_poll

void AVRISP_poll(void){  extern uchar usbNewDeviceAddr;  usbPoll();  if ((STK500_rxLen))    {      STK500_processmessage();      STK500_rxLen = 0; 	}  if(usbNewDeviceAddr)    leds[LED_BLUE].frequency = LED_ON;  if ((STK500_txLen) && (usbInterruptIsReady()))    {	  RSP_Pkg_Len = STK500_txLen - STK500_txLen_tmp;	  if(RSP_Pkg_Len > USB_EP_SIZE)		RSP_Pkg_Len = USB_EP_SIZE;	  usbSetInterrupt((uchar*)STK500_Buffer + STK500_txLen_tmp,RSP_Pkg_Len);		STK500_txLen_tmp += RSP_Pkg_Len;      if(RSP_Pkg_Len < USB_EP_SIZE)		{	 	  STK500_txLen = 0;		  STK500_txLen_tmp = 0;		}    }}
开发者ID:Technus,项目名称:usbavrlab-tool,代码行数:26,



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


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