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

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

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

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

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

示例1: main

/* * Application entry point. */int main(void) {  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  chSysInit();  /*   * Initializes a serial-over-USB CDC driver.   */  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(1500);  usbStart(serusbcfg.usbp, &usbcfg);  usbConnectBus(serusbcfg.usbp);  /*   * Creates the blinker thread.   */  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);  /*   * LSM303DLHC Object Initialization   */  lsm303dlhcObjectInit(&LSM303DLHCD1);  /*   * Activates the LSM303DLHC driver.   */  lsm303dlhcStart(&LSM303DLHCD1, &lsm303dlhccfg);  /*   * Shell manager initialization.   */  shellInit();  while(TRUE) {    if (SDU1.config->usbp->state == USB_ACTIVE) {      thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE,                                              "shell", NORMALPRIO + 1,                                              shellThread, (void *)&shell_cfg1);      chThdWait(shelltp);               /* Waiting termination.             */    }    chThdSleepMilliseconds(1000);  }  lsm303dlhcStop(&LSM303DLHCD1);  return 0;}
开发者ID:mabl,项目名称:ChibiOS,代码行数:63,


示例2: usb_serial_start

void usb_serial_start(void) {	/*	 * Initializes a serial-over-USB CDC driver.	 */	sduObjectInit(&SDU1);	sduStart(&SDU1, &serusbcfg);	/*	 * Activates the USB driver and then the USB bus pull-up on D+.	 * Note, a delay is inserted in order to not have to disconnect the cable	 * after a reset.	 */	usbDisconnectBus(serusbcfg.usbp);	chThdSleepMilliseconds(1500);	usbStart(serusbcfg.usbp, &usbcfg);	usbConnectBus(serusbcfg.usbp);	#if HAL_USE_SERIAL	/*	 * Activates the serial driver 2 using the driver default configuration.	 */	sdStart(&SD2, NULL);#endif	isUsbSerialInitialized = true;}
开发者ID:jharvey,项目名称:rusefi,代码行数:26,


示例3: InitPConnection

void InitPConnection(void) {  extern int32_t _flash_end;  fwid = CalcCRC32((uint8_t *)(FLASH_BASE_ADDR),                   (uint32_t)(&_flash_end) & 0x07FFFFF);  /*   * Initializes a serial-over-USB CDC driver.   */  mduObjectInit(&MDU1);  mduStart(&MDU1, &midiusbcfg);  bduObjectInit(&BDU1);  bduStart(&BDU1, &bulkusbcfg);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(midiusbcfg.usbp);  chThdSleepMilliseconds(1000);  usbStart(midiusbcfg.usbp, &usbcfg);  usbConnectBus(midiusbcfg.usbp);  chThdCreateStatic(waThreadUSBDMidi, sizeof(waThreadUSBDMidi), NORMALPRIO,                    ThreadUSBDMidi, NULL);}
开发者ID:Buerk,项目名称:axoloti,代码行数:27,


示例4: main

/* * Application entry point. */int main(void) {	/* HAL&RTOS init */	halInit();	chSysInit();	/* SD/FATFS init */	sdcStart(&SDCD1, NULL );	wf_init(NORMALPRIO);	/* POSIX compatibility layer initialization */	posix_init();	posix_init_chstream(STDIN_FILENO, (BaseSequentialStream *) &SDU1);	posix_init_chstream(STDOUT_FILENO, (BaseSequentialStream *) &SDU1);	posix_init_chstream(STDERR_FILENO, (BaseSequentialStream *) &SDU1);	/* Initializes a serial-over-USB CDC driver */	sduObjectInit(&SDU1);	sduStart(&SDU1, &serusbcfg);	usbDisconnectBus(serusbcfg.usbp);	chThdSleepMilliseconds(1000);	usbStart(serusbcfg.usbp, &usbcfg);	usbConnectBus(serusbcfg.usbp);	ngshell_init(&sh1, sh1_wa, SHELL_WA_SIZE, NORMALPRIO);	while (TRUE)		chThdSleepMilliseconds(500);}
开发者ID:martinribelotta,项目名称:ChibiOS-JS,代码行数:32,


示例5: main

intmain(void){  halInit();  chSysInit();  static const evhandler_t evhndl[] = { };  // CDC.  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  usbDisconnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(1500);  usbStart(serusbcfg.usbp, &usbcfg);  usbConnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(4000);  uart_init();  chThdCreateStatic(uart_thread_wa, sizeof(uart_thread_wa), NORMALPRIO, uart_thread, NULL);  while (true)  {    palTogglePad(GPIOC, GPIOC_LED);    chEvtDispatch(evhndl, chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(100)));  }}
开发者ID:rasmartins,项目名称:fbv2kpa,代码行数:26,


示例6: main

int main(void){    halInit();    chSysInit();    chBSemObjectInit(&frame_thread_sem, false);    bus_init();    power_init();    sduObjectInit(&SDU1);    sduStart(&SDU1, &serusbcfg);    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(1500);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);    chThdCreateStatic(frame_thread_wa, sizeof(frame_thread_wa),        NORMALPRIO, frame_thread, NULL);    while(true) {        usb_rx(streamGet(&SDU1));    }}
开发者ID:cillian64,项目名称:thegrid,代码行数:25,


示例7: main

int main(void) {	thread_t *sh = NULL;	PollerData.temp = 0;	PollerData.press = 0;/*	PollerData.uTime = 0;*/	halInit();	chSysInit();	shellInit();		usbDisconnectBus(serusbcfg.usbp);	chThdSleepMilliseconds(1000);	usbStart(serusbcfg.usbp, &usbcfg);	usbConnectBus(serusbcfg.usbp);		sduObjectInit(&SDU1);	sduStart(&SDU1, &serusbcfg);	// SPI-related pins (for display)	palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL); 	palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);	palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5));	palSetPadMode(GPIOB, 14, PAL_MODE_OUTPUT_PUSHPULL);	palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5));	spiStart(&SPID1, &spi1cfg);	spiStart(&SPID2, &spi2cfg);	i2cStart(&I2CD1, &i2cconfig);	initGyro();	initAccel();	initMag();//	nunchuk_status = nunchuk_init();	bmp085_status = bmp085_init();	lcd5110Init();	lcd5110SetPosXY(0, 0);	lcd5110WriteText("P :: ");	lcd5110SetPosXY(0, 1);	lcd5110WriteText("T :: ");	chThdCreateStatic(waThreadBlink, sizeof(waThreadBlink), NORMALPRIO, ThreadBlink, NULL);	chThdCreateStatic(waThreadButton, sizeof(waThreadButton), NORMALPRIO, ThreadButton, NULL);	chThdCreateStatic(waPoller, sizeof(waPoller), NORMALPRIO, ThreadPoller, NULL);    while (TRUE) {		if (!sh) {			sh = shellCreate(&shCfg, SHELL_WA_SIZE, NORMALPRIO);		}		else if (chThdTerminatedX(sh)) {			chThdRelease(sh);			sh = NULL;		}		chThdSleepMilliseconds(1000);	}	return 0; // never returns, lol}
开发者ID:part1zano,项目名称:stm32-chibios,代码行数:59,


示例8: main

/* * Application entry point. */int main(void) {  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  chSysInit();  /*   * Initializes a serial-over-USB CDC driver.   */  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  /*   * Configuring USB DP and DM PINs.   */  palSetPadMode(GPIOA, GPIOA_PIN11, PAL_MODE_INPUT);  palSetPadMode(GPIOA, GPIOA_PIN12, PAL_MODE_INPUT);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(1500);  usbStart(serusbcfg.usbp, &usbcfg);  usbConnectBus(serusbcfg.usbp);  /*   * Shell manager initialization.   */  shellInit();  /*   * Creates the blinker thread.   */  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);  /*   * Normal main() thread activity, spawning shells.   */  while (true) {    if (SDU1.config->usbp->state == USB_ACTIVE) {      thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE,                                              "shell", NORMALPRIO + 1,                                              shellThread, (void *)&shell_cfg1);      chThdWait(shelltp);               /* Waiting termination.             */    }    chThdSleepMilliseconds(1000);  }}
开发者ID:oh3eqn,项目名称:ChibiOS,代码行数:60,


示例9: main

/* * Application entry point. */int main(void) {  Thread *shelltp = NULL;  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  chSysInit();  /*   * Initializes a serial-over-USB CDC driver.   */  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(1000);  usbStart(serusbcfg.usbp, &usbcfg);  usbConnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(100);  /*   * Shell manager initialization.   */  shellInit();  /*   * Initializes the SDIO drivers.   */  mmcObjectInit(&MMCD1);  mmcStart(&MMCD1, &mmccfg);  /*   * Normal main() thread activity, in this demo it does nothing except   * sleeping in a loop and check the button state.   */  while (TRUE) {    if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))      shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);    else if (chThdTerminated(shelltp)) {      chThdRelease(shelltp);    /* Recovers memory of the previous shell.   */      shelltp = NULL;           /* Triggers spawning of a new shell.        */    }  chThdSleepMilliseconds(1000);}}
开发者ID:CCrashBandicot,项目名称:portapack-hackrf,代码行数:59,


示例10: main

/* * Application entry point. */int main(void) {  thread_t *shelltp = NULL;  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  chSysInit();#if defined(DEBUG_USB)  palSetPadMode(GPIOA, 1, PAL_MODE_ALTERNATIVE_2);  palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATIVE_2);  sdStart(&SD1, &s0cfg);#endif /* DEBUG_USB */  /*   * Initializes a serial-over-USB CDC driver.   */  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(serusbcfg.usbp);#if defined(DEBUG_USB)  usb_debug_init();#endif /* DEBUG_USB */  chThdSleepMilliseconds(1000);  usbStart(serusbcfg.usbp, &usbcfg);  usbConnectBus(serusbcfg.usbp);  /*   * Shell manager initialization.   */  shellInit();  while (!chThdShouldTerminateX()) {     if (!shelltp && (serusbcfg.usbp->state == USB_ACTIVE))      shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);    else if (chThdTerminatedX(shelltp)) {      chThdRelease(shelltp);    /* Recovers memory of the previous shell.   */      shelltp = NULL;           /* Triggers spawning of a new shell.        */    }    chThdSleepMilliseconds(1000);    palTogglePad(GPIOB, GPIOB_LED);  }  return 0;}
开发者ID:dotdash32,项目名称:tmk_keyboard,代码行数:59,


示例11: main

//fungsi utamaint main (void) {		//inisialisasi HAL (Hardware Abstraction Layer)	halInit();		//inisialisasi kernel	chSysInit();		Adc_Init();		process_running();		//inisialisasi CAN	CAN_Config();		// serial	sdStart(&SD2,NULL);      palSetPadMode(GPIOB,3, PAL_MODE_ALTERNATE(7)); //TX    palSetPadMode(GPIOB,4, PAL_MODE_ALTERNATE(7)); //RX    sdStart(&SD1,NULL);    palSetPadMode(GPIOA,9, PAL_MODE_ALTERNATE(7)); //TX    palSetPadMode(GPIOA,10, PAL_MODE_ALTERNATE(7)); //RX    sdStart(&SD3,NULL);    palSetPadMode(GPIOB,10, PAL_MODE_ALTERNATE(7)); //TX    palSetPadMode(GPIOE,15, PAL_MODE_ALTERNATE(7)); //RX    	//inisialisasi USB	sduObjectInit(&SDU1);    sduStart(&SDU1, &serusbcfg);        //aktifasi USB    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(200);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);		//thread 1	chThdCreateStatic(waBacavolt, sizeof(waBacavolt), NORMALPRIO, Bacavolt, NULL);	chThdCreateStatic(waBacacurrent, sizeof(waBacacurrent), NORMALPRIO, Bacacurrent, NULL);	chThdCreateStatic(waThreadBMS, sizeof(waThreadBMS), NORMALPRIO, ThreadBMS, NULL);	//chThdCreateStatic(waThreadkirimjoule, sizeof(waThreadkirimjoule), NORMALPRIO, Threadkirimjoule, NULL);	//chThdCreateStatic(waThreadkirimjoule2, sizeof(waThreadkirimjoule2), NORMALPRIO, Threadkirimjoule2, NULL);while(TRUE) {	kirim_data_usart1();    chprintf((BaseSequentialStream *)&SD1,"%d,%f,%d,%d,%f,%f,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%d,%d,%d,%d /n",avgtemp,packsoc,packDCL,packCCL,lowvoltcell,highvoltcell,hightemp,lowtemp,packcurrent,packvolt,amphours,supply12v, deltacellvolt,avgcellvolt,mppt1_v,mppt2_v,mppt3_v,mppt4_v,mppt5_v,mppt6_v,mppt7_v,mppt8_v,mppt9_v,mppt10_v,mppt11_v,mppt12_v,mppt13_v,mppt15_v,mppt16_v, mppt1_i, mppt2_i, mppt3_i, mppt4_i, mppt5_i, mppt6_i, mppt7_i,mppt8_i, mppt9_i, mppt10_i, mppt11_i, mppt12_i, mppt13_i, mppt14_i, mppt15_i,current1,current2,current3,voltage1,voltage2,voltage3,milidetik,detik,menit,jam);    //chprintf((BaseSequentialStream *)&SDU1,"%d,%f,%d,%d,%f,%f,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f /n",avgtemp,packsoc,packDCL,packCCL,lowvoltcell,highvoltcell,hightemp,lowtemp,packcurrent,packvolt,amphours,supply12v, deltacellvolt,avgcellvolt,mppt1_v,mppt2_v,mppt3_v,mppt4_v,mppt5_v,mppt6_v,mppt7_v,mppt8_v,mppt9_v,mppt10_v,mppt11_v,mppt12_v,mppt13_v,mppt15_v,mppt16_v, mppt1_i, mppt2_i, mppt3_i, mppt4_i, mppt5_i, mppt6_i, mppt7_i,mppt8_i, mppt9_i, mppt10_i, mppt11_i, mppt12_i, mppt13_i, mppt14_i, mppt15_i);    //chprintf((BaseSequentialStream *)&SDU1,"%x %x %x %x %x %x %x %x /n",RxMessage33.StdId, RxMessage44.StdId, RxMessage55.StdId, RxMessage66.StdId, RxMessage77.StdId, RxMessage88.StdId, RxMessage99.StdId, RxMessage11.StdId);     //chprintf((BaseSequentialStream *)&SD1,"tes /n");    chThdSleepMilliseconds(500);}   return 0 ;}	
开发者ID:FebrynNGK,项目名称:Example-dari-Orang-Lain,代码行数:57,


示例12: vcom_usbInit

void vcom_usbInit(void) {    sduObjectInit(&SDU1);    sduStart(&SDU1, &serusbcfg);    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(1000);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);}
开发者ID:DMeyer,项目名称:nimbus,代码行数:10,


示例13: ezspInit

EzspStatus ezspInit(void){  EzspStatus status;  status = usbStart();  if (status!=EZSP_SUCCESS)  {    return status;  }  return usbResetNcp();}
开发者ID:taidalab,项目名称:ZigBeeember570,代码行数:10,


示例14: main

/* * Application entry point. */int main(void) {	Thread *shelltp0 = NULL;	Thread *shelltp2 = NULL;	//unsigned int i = 0;	/*	 * System initializations.	 * - HAL initialization, this also initializes the configured device drivers	 *   and performs the board-specific initializations.	 * - Kernel initialization, the main() function becomes a thread and the	 *   RTOS is active.	 */	halInit();	chSysInit();	/*	 * Initializes a serial-over-USB CDC driver.	 */	sduObjectInit(&SDU1);	sduStart(&SDU1, &serusbcfg);	/*	 * Activates the USB driver and then the USB bus pull-up on D+.	 * Note, a delay is inserted in order to not have to disconnect the cable	 * after a reset.	 */	usbDisconnectBus(serusbcfg.usbp);	chThdSleepMilliseconds(1500);	usbStart(serusbcfg.usbp, &usbcfg);	usbConnectBus(serusbcfg.usbp);	/* added by myself */	chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);	/* added by myself */	/*	 * Normal main() thread activity, in this demo it just performs	 * a shell respawn upon its termination.	 */	while (1) {		if (!shelltp0) {			if (SDU1.config->usbp->state == USB_ACTIVE) {				/* Spawns a new shell.*/				shelltp0 = shellCreate(&shell_cfg0, SHELL_WA_SIZE, NORMALPRIO);			}		} else {			/* If the previous shell exited.*/			if (chThdTerminated(shelltp0)) {				/* Recovers memory of the previous shell.*/				chThdRelease(shelltp0);				shelltp0 = NULL;			}		}		chThdSleepMilliseconds(1000);	}}
开发者ID:dm13dv1b,项目名称:ChibiOS_STM32F4Disc_Console,代码行数:58,


示例15: init_usb_driver

/* * Initialize the USB driver */void init_usb_driver(void) {  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(hiddebugcfg.usbp);  chThdSleepMilliseconds(1500);  usbStart(hiddebugcfg.usbp, &usbcfg);  usbConnectBus(hiddebugcfg.usbp);}
开发者ID:flabbergast,项目名称:chibios-projects,代码行数:14,


示例16: main

/* * Application entry point. */int main(void) {  Thread *shelltp = NULL;  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  chSysInit();  /*   * Activates the serial driver 1 using the driver default configuration.   */  sdStart(&SD1, NULL);  /*   * Shell manager initialization.   */  shellInit();  /*   * Starts the LED blinker thread.   */  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  usbStart(serusbcfg.usbp, &usbcfg);  usbDisconnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(1000);  usbConnectBus(serusbcfg.usbp);  /*   * Normal main() thread activity, in this demo it does nothing except   * sleeping in a loop and listen for events.   */  while (TRUE) {/*    if (!shelltp) {*/    if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE)) {/*      chprintf((BaseSequentialStream *)&SD1, "USB Active/r/n");*/      shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);    }    else if (chThdTerminated(shelltp)) {      chThdRelease(shelltp);    /* Recovers memory of the previous shell. */      shelltp = NULL;           /* Triggers spawning of a new shell.      */    }    chThdSleepMilliseconds(100);  }  return 0;}
开发者ID:GotoHack,项目名称:ChibiOS,代码行数:57,


示例17: main

/* * Application entry point. */int main(void) {  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  /* This is needed to remap the USB pins PA11,PA12 onto the default PA9,PA10   * so that the USB works. After halInit (which changes that register).   * This also means that USART1 can't be used, as it is on PA9,PA10.   */  SYSCFG->CFGR1 |= SYSCFG_CFGR1_PA11_PA12_RMP;  chSysInit();  palSetPadMode(GPIOB, 7, PAL_MODE_OUTPUT_PUSHPULL);  /*   * Initializes a serial-over-USB CDC driver.   */  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(1500);  usbStart(serusbcfg.usbp, &usbcfg);  usbConnectBus(serusbcfg.usbp);  /*   * Creates the blinker thread.   */  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);  /*   * Normal main() thread activity, in this demo it does nothing except   * sleeping in a loop and check the button state.   */  while(true) {    if((palReadPad(GPIOB, GPIOB_BUTTON) == PAL_HIGH) && (SDU1.config->usbp->state == USB_ACTIVE)) {      /* sdWrite(&SDU1, (uint8_t *)"hello world/r/n", 13); */      chprintf((BaseSequentialStream *)&SDU1, "Hello world/r/n");      /* chnWrite((BaseChannel *)&SDU1, (uint8_t *)"Hello, world/r/n", 14); */    }    chThdSleepMilliseconds(200);  }}
开发者ID:flabbergast,项目名称:chibios-projects,代码行数:55,


示例18: startUsbControl

/* * Start all usb related threads and initiate the USB subsytem. */void startUsbControl(void) {  chMBInit (&usbTXMailbox, (msg_t *)usbTXMailboxBuffer, USB_MAILBOX_SIZE);  chMBInit (&usbRXMailbox, (msg_t *)usbRXMailboxBuffer, USB_MAILBOX_SIZE);  chPoolInit (&usbMemPool, USB_PACKET_SIZE, NULL);  chPoolLoadArray(&usbMemPool, &usbMemPoolBuffer, USB_MEM_POOL_SIZE);  chThdCreateStatic(waUsbTx, sizeof(waUsbTx), NORMALPRIO, tUsbTx, NULL);  chThdCreateStatic(waUsbRx, sizeof(waUsbRx), NORMALPRIO, tUsbRx, NULL);  //Start and Connect USB  usbStart(usbp, &config);  usbConnectBus(usbp);}
开发者ID:kjellhar,项目名称:chibi-bldc,代码行数:17,


示例19: comm_usb_serial_init

void comm_usb_serial_init(void) {	sduObjectInit(&SDU1);	sduStart(&SDU1, &serusbcfg);	/*	 * Activates the USB driver and then the USB bus pull-up on D+.	 * Note, a delay is inserted in order to not have to disconnect the cable	 * after a reset.	 */	usbDisconnectBus(serusbcfg.usbp);	chThdSleepMilliseconds(1500);	usbStart(serusbcfg.usbp, &usbcfg);	usbConnectBus(serusbcfg.usbp);}
开发者ID:1ee7,项目名称:bldc,代码行数:14,


示例20: vSystemInitList

/* * @brief   The function containing all drivers and modules to be initialized. *          All initialization should be here (except internal inits). * * @note    ChibiOS Sys init and HAL init shall not be in here, it's in main. */static void vSystemInitList(void){    /*     *     * Add all driver and module initializations here!     *     */    /* Activates the USB driver and then the USB bus pull-up on D+. */    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(500);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);}
开发者ID:TotalKrill,项目名称:evb1000_chibi,代码行数:20,


示例21: startupInit

void startupInit(){    usbdataEnable();	gdispSetBacklight(50);	gdispSetContrast(50);	geventListenerInit(&gl);	gwinAttachListener(&gl);	// Setup UI objects and show splash	guiCreate();	gwinProgressbarSetResolution(ghProgbarLoad, 10);	gwinProgressbarStart(ghProgbarLoad, 300);	graphInit();	// Setup INA219 I2C Current Sensor	ina219Init();	sduObjectInit(USB_SERIAL_DRIVER);	sduStart(USB_SERIAL_DRIVER, &serusbcfg);	/*	 * Activates the USB driver and then the USB bus pull-up on D+.	 * Note, a delay is inserted in order to not have to disconnect the cable	 * after a reset.	 */	usbDisconnectBus(serusbcfg.usbp);	chThdSleepMilliseconds(1000);	usbStart(serusbcfg.usbp, &usbcfg);	usbConnectBus(serusbcfg.usbp);	setStartTime();	chThdCreateStatic(ledThread, sizeof(ledThread), LOWPRIO, ThreadLED, NULL);	chThdCreateStatic(inaThread, sizeof(inaThread), HIGHPRIO, ThreadINA, NULL);	chThdCreateStatic(gfxvalThread, sizeof(gfxvalThread), NORMALPRIO, ThreadGFXVal, NULL);	chThdCreateStatic(timeThread, sizeof(timeThread), NORMALPRIO, ThreadTIME, NULL);	chThdCreateStatic(gfxEventThread, sizeof(gfxEventThread), NORMALPRIO, ThreadGFXEvent, NULL);	chThdSleepMilliseconds(2000);	chThdCreateStatic(graphThread, sizeof(graphThread), NORMALPRIO+5, ThreadGRAPH, NULL);	// Destroy splay screen and show main page	gwinDestroy(ghContainerPageSplash);	guiShowPage(1);}
开发者ID:FriedCircuits,项目名称:USBMultimeter,代码行数:47,


示例22: main

int main(void) {    halInit();    chSysInit();    chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO - 1, Thread1, NULL);    uint8_t my_addr, other_addr;    if (true) {        my_addr = 0x42;        other_addr = 0x43;    } else {        my_addr = 0x43;        other_addr = 0x42;    }    palSetPadMode(GPIOD, 5, PAL_MODE_ALTERNATE(7));    palSetPadMode(GPIOD, 6, PAL_MODE_ALTERNATE(7) + PAL_STM32_PUPDR_PULLUP);    sdStart(&SD2, NULL); // PD5 TX, PD6 RX    sdStart(&SD3, NULL); // connected to stlink    sduObjectInit(&SDU1);    sduStart(&SDU1, &serusbcfg);    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(100);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(100);    net_init(my_addr);    // interface 0, USB    chThdCreateStatic(net_rx0_thd_wa, sizeof(net_rx0_thd_wa),                      NORMALPRIO - 1, net_rx0_thd, &SDU1);    // interface 1 UART connection to other node    chThdCreateStatic(net_rx1_thd_wa, sizeof(net_rx1_thd_wa),                      NORMALPRIO - 1, net_rx1_thd, &SD2);    net_route_add(&net_node, other_addr, 0xff, 1, 0);    int i = 0;    while (true) {        chprintf((BaseSequentialStream *)&SD3, "node %x, counting %d/n", my_addr, i++);        chThdSleepMilliseconds(500);    }}
开发者ID:Stapelzeiger,项目名称:INS-board-fw,代码行数:44,


示例23: main

/* * Application entry point. */int main(void) {  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  chSysInit();  palSetPadMode(IOPORT3, BOARD_LED1, PAL_MODE_OUTPUT_PUSHPULL);  palClearPad(IOPORT3, BOARD_LED1);  /*   * Initializes a serial-over-USB CDC driver.   */  sduObjectInit(&SDU1);  sduStart(&SDU1, &serusbcfg);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(serusbcfg.usbp);  chThdSleepMilliseconds(1000);  usbStart(serusbcfg.usbp, &usbcfg);  usbConnectBus(serusbcfg.usbp);  /*   * Starts the LED blinker thread.   */  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);  while (true) {    if (SDU1.config->usbp->state == USB_ACTIVE) {      chnWrite(&SDU1, (const uint8_t *)"Hello from Arduino Leonardo!/r/n", 30);    }    chThdSleepMilliseconds(2113);  }}
开发者ID:ChibiOS,项目名称:ChibiOS,代码行数:46,


示例24: main

/* * Application entry point. */int main(void) {  /*   * System initializations.   * - HAL initialization, this also initializes the configured device drivers   *   and performs the board-specific initializations.   * - Kernel initialization, the main() function becomes a thread and the   *   RTOS is active.   */  halInit();  chSysInit();  /*   * GPIOI1 is programmed as output (board LED).   */  palClearLine(LINE_ARD_D13);  palSetLineMode(LINE_ARD_D13, PAL_MODE_OUTPUT_PUSHPULL);  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  usbDisconnectBus(&USBD2);  chThdSleepMilliseconds(1500);  usbStart(&USBD2, &usbcfg);  usbConnectBus(&USBD2);  /*   * Starting threads.   */  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);  chThdCreateStatic(waWriter, sizeof(waWriter), NORMALPRIO, Writer, NULL);  chThdCreateStatic(waReader, sizeof(waReader), NORMALPRIO, Reader, NULL);  /*   * Normal main() thread activity, in this demo it does nothing except   * sleeping in a loop and check the button state.   */  while (true) {    chThdSleepMilliseconds(1000);  }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:46,


示例25: myUSBinit

// halInit() and chSysInit() should be called from user class, before initiating usb (before using this functions)void myUSBinit(void){  /*   * Shell manager initialization.   */  shellInit();  /*   * Activates the USB driver and then the USB bus pull-up on D+.   * Note, a delay is inserted in order to not have to disconnect the cable   * after a reset.   */  //Start and Connect USB  usbDisconnectBus(usbp);  chThdSleepMilliseconds(1000);  usbStart(usbp, &config);  usbConnectBus(usbp);}
开发者ID:Dionysios,项目名称:STM_Library_2,代码行数:20,


示例26: main

int main(void){    /*     * System initializations.     * - HAL initialization, this also initializes the configured      *   device drivers and performs the board-specific initializations.     * - Kernel initialization, the main() function becomes a thread     *   and the RTOS is active.     */    halInit();    chSysInit();    /*     *     * Initializes a serial-over-USB CDC driver.     *      */    sduObjectInit(&SDU1);    sduStart(&SDU1, &serusbcfg);    /*     *     * Activates the USB driver and then the USB bus pull-up on D+.     *      */    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(1000);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);    /*      *     *  User application.     *     */    while(1)    {        palTogglePad(GPIOC, GPIOC_LED_USR);        chThdSleepMilliseconds(200);    }}
开发者ID:korken89,项目名称:EmbeddedGenericSensor,代码行数:42,


示例27: usbcdc_init

void usbcdc_init(const ShellCommand * commands){        shell_cfg2.sc_commands = commands;          /*           * Initializes a serial-over-USB CDC driver.           */          sduObjectInit(&SDU1);          sduStart(&SDU1, &serusbcfg);          /*          * Activates the USB driver and then the USB bus pull-up on D+.          * Note, a delay is inserted in order to not have to disconnect the cable          * after a reset.          */           usbDisconnectBus(serusbcfg.usbp);           chThdSleepMilliseconds(1500);           usbStart(serusbcfg.usbp, &usbcfg);           usbConnectBus(serusbcfg.usbp);}
开发者ID:glocklueng,项目名称:LightwallController,代码行数:20,


示例28: BoardDriverStart

void BoardDriverStart(void){    ws281xStart(&ws281x, &ws281x_cfg);    palSetPadMode(GPIOA, 1, PAL_MODE_STM32_ALTERNATE_PUSHPULL);    /*     * Initializes a serial-over-USB CDC driver.     */    sduStart(&SDU1, &serusbcfg);    /*     * Activates the USB driver and then the USB bus pull-up on D+.     * Note, a delay is inserted in order to not have to disconnect the cable     * after a reset.     */    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(1000);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);}
开发者ID:janfietz,项目名称:nightSky,代码行数:20,


示例29: initializeUSB

void initializeUSB(void) {    /*     * Shell manager initialization.     */    shellInit();    /*     * Initializes a serial-over-USB CDC driver.     */    sduObjectInit(&SDU1);    sduStart(&SDU1, &serusbcfg);    /*     * Activates the USB driver and then the USB bus pull-up on D+.     * Note, a delay is inserted in order to not have to disconnect the cable     * after a reset.     */    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(1000);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);}
开发者ID:Jessie-SEM,项目名称:MiniatureSmartVehicle,代码行数:22,


示例30: BoardDriverStart

void BoardDriverStart(void){    spiStart(&SPID1, &SPI1cfg);    MFRC522Start(&RFID1, &RFID1_cfg);    ws2811Start(&ws2811, &ws2811_cfg);    palSetGroupMode(GPIOA, 0b00000010, 0, PAL_MODE_OUTPUT_PUSHPULL|PAL_STM32_OSPEED_HIGHEST|PAL_STM32_PUDR_FLOATING);    /*     * Initializes a serial-over-USB CDC driver.     */    sduStart(&SDU1, &serusbcfg);    /*     * Activates the USB driver and then the USB bus pull-up on D+.     * Note, a delay is inserted in order to not have to disconnect the cable     * after a reset.     */    usbDisconnectBus(serusbcfg.usbp);    chThdSleepMilliseconds(1000);    usbStart(serusbcfg.usbp, &usbcfg);    usbConnectBus(serusbcfg.usbp);}
开发者ID:janfietz,项目名称:toddlerMusicBoxControl,代码行数:23,



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


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