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


C++ USBD_Init函数代码示例

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


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

示例1: Demo_USBConfig

/**
  * @brief  Initializes the USB for the demonstration application.
  * @param  None
  * @retval None
  */
static uint32_t Demo_USBConfig(void)
{
  /* Init Device Library */
  USBD_Init(&hUSBDDevice, &HID_Desc, 0);
  
  /* Add Supported Class */
  USBD_RegisterClass(&hUSBDDevice, USBD_HID_CLASS);
  
  /* Start Device Process */
  USBD_Start(&hUSBDDevice);
  
  return 0;
}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:18,代码来源:main.c

示例2: usb_serial_init

void usb_serial_init(void)
{
	USBD_Init(&USB_OTG_dev,
#ifdef USE_USB_OTG_HS 
			USB_OTG_HS_CORE_ID,
#else            
			USB_OTG_FS_CORE_ID,
#endif  
			&USR_desc, 
			&USBD_CDC_cb, 
			&USR_cb);

}
开发者ID:sebseb7,项目名称:stripe_player,代码行数:13,代码来源:usb_serial.c

示例3: USBDSTOR_Start

/**
  * @brief  Start USBD
  * @param  None.
  * @retval USBD status.
  */
USBD_ErrorTypdef  USBDSTOR_Start(void)
{ 
  /* Init MSC Application */
  USBD_Init(&USBD_Device, &MSC_Desc, 0);
  
  /* Add Supported Class */
  USBD_RegisterClass(&USBD_Device, &USBD_MSC);
  
  /* Add Storage callbacks for MSC Class */
  USBD_MSC_RegisterStorage(&USBD_Device, &USBD_DISK_fops);
    
  return USBD_ERROR_NONE;
}
开发者ID:EarnestHein89,项目名称:STM32Cube_FW_F4,代码行数:18,代码来源:usbd_app.c

示例4: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();
  
  /* Configure the system clock to 168 MHz */
  SystemClock_Config();
  
  /* Configure Key Button */
  BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
  
  /* Check if the KEY Button is pressed */
  if(BSP_PB_GetState(BUTTON_KEY) != 0x00)
  {
    /* Test if user code is programmed starting from address 0x0800C000 */
    if(((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFE0000 ) == 0x20000000)
    {
      /* Jump to user application */
      JumpAddress = *(__IO uint32_t*) (USBD_DFU_APP_DEFAULT_ADD + 4);
      JumpToApplication = (pFunction) JumpAddress;
      
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) USBD_DFU_APP_DEFAULT_ADD);
      JumpToApplication();
    }
  }
  
  /* Otherwise enters DFU mode to allow user programing his application */
  /* Init Device Library */
  USBD_Init(&USBD_Device, &DFU_Desc, 0);
  
  /* Add Supported Class */
  USBD_RegisterClass(&USBD_Device, USBD_DFU_CLASS);
  
  /* Add DFU Media interface */
  USBD_DFU_RegisterMedia(&USBD_Device, &USBD_DFU_Flash_fops);

  /* Start Device Process */
  USBD_Start(&USBD_Device);
  
  /* Run Application (Interrupt mode) */
  while (1)
  {
  }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF4,代码行数:55,代码来源:main.c

示例5: USB_CDC_device_init

int USB_CDC_device_init(const int priority)
{
    vcp_setup();

    /* Initialize the USB hardware */
    USBD_Init(&USB_OTG_dev,
              USB_OTG_FS_CORE_ID,
              &USR_desc,
              &USBD_CDC_cb,
              &USR_cb);
    _init_flag = 1;

    return 0;
}
开发者ID:imhoffj,项目名称:RaceCapture-Pro_firmware,代码行数:14,代码来源:USB-CDC_device_stm32.c

示例6: MX_USB_DEVICE_Init

/* init function */				        
void MX_USB_DEVICE_Init(void)
{
  /* Init Device Library,Add Supported Class and Start the library*/
  USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);
  USBD_RegisterClass(&hUsbDeviceFS, &USBD_MSC);
  USBD_MSC_RegisterStorage(&hUsbDeviceFS, &USBD_Storage_Interface_fops_FS);
  /* Verify if the Battery Charging Detection mode (BCD) is used : */
  /* If yes, the USB device is started in the HAL_PCDEx_BCD_Callback */
  /* upon reception of PCD_BCD_DISCOVERY_COMPLETED message. */
  /* If no, the USB device is started now. */
  if (USBD_LL_BatteryCharging(&hUsbDeviceFS) != USBD_OK) {
  USBD_Start(&hUsbDeviceFS);
  }
}
开发者ID:molnard,项目名称:STM32L476_FT811,代码行数:15,代码来源:usb_device.c

示例7: usbInit

void usbInit(void)
{
  USBD_Init(&USB_OTG_dev,
            USB_OTG_FS_CORE_ID,
            &USR_desc,
            &cf_usb_cb,
            &USR_cb);

  // This should probably be reduced to a CRTP packet size
  usbDataRx = xQueueCreate(5, sizeof(USBPacket)); /* Buffer USB packets (max 64 bytes) */
  usbDataTx = xQueueCreate(1, sizeof(USBPacket)); /* Buffer USB packets (max 64 bytes) */

  isInit = true;
}
开发者ID:erwincoumans,项目名称:crazyflie-firmware,代码行数:14,代码来源:usb.c

示例8: MULTIDriver_Initialize

//-----------------------------------------------------------------------------
/// Initializes the USB device composite device driver.
//-----------------------------------------------------------------------------
void MULTIDriver_Initialize(void)
{

    CDCDFunctionDriver_Initialize();

	/* CCID nees no initialization */

    // Initialize the standard USB driver
    USBDDriver_Initialize(&usbdDriver,
                          &multiDriverDescriptors,
                          multiDriverInterfaces);

    // Initialize the USB driver
    USBD_Init();
}
开发者ID:12019,项目名称:at91work,代码行数:18,代码来源:MULTIDriver.c

示例9: main

int main(void)
{
	fpu_enable();
	system_init();
	pll_start(CRYSTAL, FREQUENCY);

	gpio_pin_cfg(GPIOD, 12, GPIO_OUT_PP_25MHz);
	gpio_pin_cfg(GPIOD, 13, GPIO_OUT_PP_25MHz);
	gpio_pin_cfg(GPIOD, 14, GPIO_OUT_PP_25MHz);
	gpio_pin_cfg(GPIOD, 15, GPIO_OUT_PP_25MHz);

	USBD_Init(&USB_Dev, USB_OTG_FS_CORE_ID, &USR_desc, &AUDIO_cb, &USR_cb);

	while(1);
}
开发者ID:Polprzewodnikowy,项目名称:stm32f4_usb_to_audio,代码行数:15,代码来源:main.c

示例10: USBD_Init

//------------------------------------------------------------------------------
Usb::Error UsbStm32f4xx::driverEnable(const bool enable)
{
    if (enable)
    {
        USBD_Init(&USB_OTG_dev,
                  USB_OTG_FS_CORE_ID,
                  &USR_desc,
                  &USBD_CDC_cb,
                  &USR_cb);

        VCP_SetDataRxCallback(rxCallback);
    }

    return ERROR_NONE;
}
开发者ID:bminerd,项目名称:Plat4m_Ui,代码行数:16,代码来源:UsbStm32f4xx.cpp

示例11: init

void init() {
	SystemInit();

	// ---------- SysTick timer -------- //
	if (SysTick_Config(SystemCoreClock / 1000)) {
		// Capture error
		while (1){};
	}

	// ------------- USB -------------- //
	USBD_Init(&USB_OTG_dev,
	            USB_OTG_FS_CORE_ID,
	            &USR_desc,
	            &USBD_CDC_cb,
	            &USR_cb);
}
开发者ID:felipepipe18,项目名称:openesc,代码行数:16,代码来源:main.c

示例12: pyb_usb_dev_init

void pyb_usb_dev_init(void) {
#ifdef USE_DEVICE_MODE
    if (!dev_is_enabled) {
        // only init USB once in the device's power-lifetime
        USBD_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_cb, &USR_cb);
        //USBD_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_PYB_HID_cb, &USR_cb);
    }
    rx_buf_in = 0;
    rx_buf_out = 0;
    interrupt_char = VCP_CHAR_NONE;
    dev_is_enabled = 1;

    // create an exception object for interrupting by VCP
    mp_const_vcp_interrupt = mp_obj_new_exception(qstr_from_str("VCPInterrupt"));
#endif
}
开发者ID:GordonMcGregor,项目名称:micropython,代码行数:16,代码来源:usb.c

示例13: main

int main(void)
{	
	int8_t i = 0;
	LED_Init();
	Usart2_Init(9600);
	Myprintf_Init(0x00,myputc);
	Timer3_Interrupt_Init(50,84);
	USBD_Init(&USB_OTG_dev,USB_OTG_FS_CORE_ID,&USR_desc,&USBD_CDC_cb,&USR_cb);
	
	while(1) 
	{	
		LED_loop();
	}

	return 0;
}
开发者ID:RdMaxes,项目名称:stm32f4_USB_VCP,代码行数:16,代码来源:main.c

示例14: UsbDevice_Init

/**
 * @brief This function handles the setup of the USB device:
 *         - Assigns endpoints to USB interfaces
 *         - Mounts the interfaces on the device
 *         - Sets up the USB device
 *         - Determines the USB port type
 *         - Establishes logical connection with the host
 */
void UsbDevice_Init() {
	/* Initialize the device */
	USBD_Init(UsbDevice, dev_cfg);

	/* All fields of Config have to be properly set up */
	ps2controller_if->Config.InEp.Num = 0x81;
	configurator_if->Config.InEp.Num = 0x82;
	configurator_if->Config.OutEp.Num = 0x02;

	// Mount the interfaces to the device
	USBD_HID_MountInterface(ps2controller_if, UsbDevice);
	USBD_HID_MountInterface(configurator_if, UsbDevice);

	// connection can be made
	USBD_Connect(UsbDevice);
}
开发者ID:zzattack,项目名称:munia,代码行数:24,代码来源:usb_musia_device.c

示例15: main

int main(void)
{
  /* Chip errata */
  CHIP_Init();
  
  /* Enable HFXO */
  CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
    
  /* Enable deboug output over UART */
  RETARGET_SerialInit();                     
  RETARGET_SerialCrLf(1); 
  
  /* Enable the segment LCD */
  SegmentLCD_Init(false);
  SegmentLCD_Write("USB");
  
  printf("\nStarting USB Device...\n");
  
  /* Set up GPIO interrupts */
  gpioInit();
  
  /* Start USB stack. Callback routines in callbacks.c will be called
   * when connected to a host.  */
  USBD_Init(&initstruct);;

  /*
   * When using a debugger it is pratical to uncomment the following three
   * lines to force host to re-enumerate the device.
   */
  /* USBD_Disconnect(); */
  /* USBTIMER_DelayMs( 1000 ); */
  /* USBD_Connect(); */
    
  while(1)
  {
    if ( USBD_SafeToEnterEM2() )
    {
      /* Enter EM2 when in suspend or disconnected */
      EMU_EnterEM2(true);
    } 
    else
    {
      /* When USB is active we can sleep in EM1. */
      EMU_EnterEM1();
    }
  } 
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:47,代码来源:main_stk.c


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