本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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)
{
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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
}
示例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;
}
示例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);
}
示例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();
}
}
}