本文整理汇总了C++中USBH_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ USBH_Init函数的具体用法?C++ USBH_Init怎么用?C++ USBH_Init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USBH_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* Enable the CPU Cache */
CPU_CACHE_Enable();
/* STM32F7xx HAL library initialization:
- Configure the Flash ART accelerator on ITCM interface
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the System clock to have a frequency of 200 Mhz */
SystemClock_Config();
/* Init Dual Core Application */
DUAL_InitApplication();
/* Init HS Core */
USBH_Init(&hUSBHost_HS, USBH_HS_UserProcess, 1);
/* Init FS Core */
USBH_Init(&hUSBHost_FS, USBH_FS_UserProcess, 0);
/* Add Supported Classes */
USBH_RegisterClass(&hUSBHost_HS, USBH_MSC_CLASS);
USBH_RegisterClass(&hUSBHost_FS, USBH_HID_CLASS);
/* Start Host Process */
USBH_Start(&hUSBHost_FS);
USBH_Start(&hUSBHost_HS);
/* Register the file system object to the FatFs module */
if(f_mount(&USBH_fatfs, "", 0) != FR_OK)
{
LCD_ErrLog("ERROR : Cannot Initialize FatFs! \n");
}
/* Run Application (Blocking mode)*/
while (1)
{
/* USB Host Background tasks */
USBH_Process(&hUSBHost_FS);
USBH_Process(&hUSBHost_HS);
/* DUAL Menu Process */
DUAL_MenuProcess();
}
}
示例2: USBH_Init
void UsbKey::init(struct OneSynthParams*timbre1, struct OneSynthParams*timbre2, struct OneSynthParams*timbre3, struct OneSynthParams*timbre4) {
Storage::init(timbre1, timbre2, timbre3, timbre4);
USBH_Init(&usbOTGHost, USB_OTG_HS_CORE_ID, &usbHost, &USBH_MSC_cb, &USR_Callbacks);
commandParams.commandState = COMMAND_INIT;
usbProcess();
#ifndef BOOTLOADER
dx7NumberOfBanks = 0;
dx7BankInitialized = false;
for (int k=0; k< NUMBEROFDX7BANKS; k++) {
dx7Bank[k].name[0] = '\0';
dx7Bank[k].name[12] = '\0';
dx7Bank[k].fileType = FILE_EMPTY;
}
for (int k=0; k<NUMBEROFPREENFMBANKS; k++) {
preenFMBank[k].fileType = FILE_EMPTY;
}
for (int k=0; k<NUMBEROFPREENFMCOMBOS; k++) {
preenFMCombo[k].fileType = FILE_EMPTY;
}
char empty[] = "<Empty>\0";
for (int k=0; k< 8; k++) {
errorDX7Bank.name[k] = empty[k];
errorPreenFMBank.name[k] = empty[k];
errorPreenFMCombo.name[k] = empty[k];
}
errorPreenFMBank.fileType = FILE_EMPTY;
errorPreenFMCombo.fileType = FILE_EMPTY;
errorDX7Bank.fileType = FILE_EMPTY;
#endif
}
示例3: k_StorageInit
/**
* @brief Storage drives initialization
* @param None
* @retval None
*/
void k_StorageInit(void)
{
/* Link the USB Host disk I/O driver */
FATFS_LinkDriver(&USBH_Driver, USBDISK_Drive);
/* Link the micro SD disk I/O driver */
FATFS_LinkDriver(&SD_Driver, mSDDISK_Drive);
/* Create USB background task */
osThreadDef(STORAGE_Thread, StorageThread, osPriorityBelowNormal, 0, 2 * configMINIMAL_STACK_SIZE);
osThreadCreate (osThread(STORAGE_Thread), NULL);
/* Create Storage Message Queue */
osMessageQDef(osqueue, 10, uint16_t);
StorageEvent = osMessageCreate (osMessageQ(osqueue), NULL);
/* Init Host Library */
USBH_Init(&hUSB_Host, USBH_UserProcess, 0);
/* Add Supported Class */
USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS);
/* Start Host Process */
USBH_Start(&hUSB_Host);
/* Enable SD Interrupt mode */
BSP_SD_Init();
BSP_SD_ITConfig();
if(BSP_SD_IsDetected())
{
osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0);
}
}
示例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();
/* Init Audio Application */
Audio_InitApplication();
/* Init Host Library */
USBH_Init(&hUSBHost, USBH_UserProcess, 0);
/* Add Supported Class */
USBH_RegisterClass(&hUSBHost, USBH_AUDIO_CLASS);
/* Start Host Process */
USBH_Start(&hUSBHost);
/* Run Application (Blocking mode) */
while (1)
{
/* USB Host Background task */
USBH_Process(&hUSBHost);
/* AUDIO Menu Process */
AUDIO_MenuProcess();
}
}
示例5: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* STM32F446xx HAL library initialization */
HAL_Init();
/* Configure the system clock to 180 Mhz */
SystemClock_Config();
/* Initialize IO expander */
BSP_IO_Init();
/* Init HID Application */
HID_InitApplication();
/* Init Host Library */
USBH_Init(&hUSBHost, USBH_UserProcess, 0);
/* Add Supported Class */
USBH_RegisterClass(&hUSBHost, USBH_HID_CLASS);
/* Start Host Process */
USBH_Start(&hUSBHost);
/* Run Application (Blocking mode) */
while (1)
{
/* USB Host Background task */
USBH_Process(&hUSBHost);
/* HID Menu Process */
HID_MenuProcess();
}
}
示例6: main
/**
* @brief main
* Main routine for IAP application
* @param None
* @retval int
*/
int main(void)
{
/* STM32 evalboard user initialization */
BSP_Init();
/* Flash unlock */
FLASH_If_FlashUnlock();
/* Test if User button on the Discovery kit is pressed */
if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_RESET)
{
/* Check Vector Table: Test if user code is programmed starting from address
"APPLICATION_ADDRESS" */
if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
Jump_To_Application();
}
}
/* Init Host Library */
USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks);
while (1)
{
/* Host Task handler */
USBH_Process(&USB_OTG_Core, &USB_Host);
}
}
示例7: main
/*
* Main function. Called when startup code is done with
* copying memory and setting up clocks.
*/
int main(void) {
GPIO_InitTypeDef GPIO_InitStructure;
// SysTick interrupt each 1ms
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
// GPIOD Peripheral clock enable
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
// Initialize LEDS (12:Green/13:Orange/14:Red/15:Blue)
// Configure PD12, PD13, PD14 and PD15 in output pushpull mode
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOD, &GPIO_InitStructure);
// Initialize USB Host Library
USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks);
for(;;) {
USBH_Process(&USB_OTG_Core, &USB_Host);
if (enum_done >= 2) {
enum_done = 0;
put_file_directory("", 0);
}
}
}
示例8: usb_init
void usb_init(void)
{
osal_sem_t *sem;
osal_task_t *task;
memset(&wifi_usb_adapter,0,sizeof(wifi_usb_adapter_t));
sem = osal_sem_create("usbh", 0);
osal_assert(sem != NULL);
USB_Host_Semphore = sem;
sem = osal_sem_create("usbc", 0);
osal_assert(sem != NULL);
USB_CtrlReq_Semphore = sem;
USBH_Init(&USB_OTG_Core_dev,
USB_OTG_FS_CORE_ID,
&USB_Host,
&USBH_Class_Cb,
&USBH_USR_Cb);
/* Finally start USB host process thread */
task = osal_task_create("usbh", usbh_thread_entry, NULL, RT_USBH_THREAD_STACK_SIZE, \
RT_USBH_THREAD_PRIORITY);
osal_assert(task != NULL);
}
示例9: MainTask
void MainTask(void) {
USBH_Init();
OS_SetPriority(OS_GetTaskID(), TASK_PRIO_APP); // This task has highest prio for real-time application
OS_CREATETASK(&_TCBMain, "USBH_Task", USBH_Task, TASK_PRIO_USBH_MAIN, _StackMain); // Start USBH main task
OS_CREATETASK(&_TCBIsr, "USBH_isr", USBH_ISRTask, TASK_PRIO_USBH_ISR, _StackIsr); // Start USBH main task
USBH_HID_Init();
while (1) {
BSP_ToggleLED(1);
if (USBH_HID_GetNumDevices(NULL, 0)) {
USBH_HID_HANDLE hDevice;
USBH_HID_DEVICE_INFO aDevInfo[20];
unsigned NumItems = COUNTOF(_aReportInfo);
USBH_HID_GetNumDevices(aDevInfo, COUNTOF(aDevInfo));
hDevice = USBH_HID_Open("hid000");
if (hDevice) {
USBH_HID_GetReportDescriptorParsed(hDevice, &_aReportInfo[0], &NumItems);
USBH_HID_GetReport(hDevice, _aReport, sizeof(_aReport), NULL, NULL);
USBH_HID_Close(hDevice);
}
}
OS_Delay(100);
}
}
示例10: 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();
/* Init Dual Core Application */
DUAL_InitApplication();
/* Init HS Core */
USBH_Init(&hUSBHost_HS, USBH_HS_UserProcess, 1);
/* Init FS Core */
USBH_Init(&hUSBHost_FS, USBH_FS_UserProcess, 0);
/* Add Supported Classes */
USBH_RegisterClass(&hUSBHost_HS, USBH_MSC_CLASS);
USBH_RegisterClass(&hUSBHost_FS, USBH_HID_CLASS);
/* Start Host Process */
USBH_Start(&hUSBHost_FS);
USBH_Start(&hUSBHost_HS);
/* Register the file system object to the FatFs module */
if(f_mount(&USBH_fatfs, "", 0) != FR_OK)
{
LCD_ErrLog("ERROR : Cannot Initialize FatFs! \n");
}
/* Run Application (Blocking mode)*/
while (1)
{
/* USB Host Background tasks */
USBH_Process(&hUSBHost_FS);
USBH_Process(&hUSBHost_HS);
/* DUAL Menu Process */
DUAL_MenuProcess();
}
}
示例11: 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 180 MHz */
SystemClock_Config();
/*Initialize the IO module*/
BSP_IO_Init ();
/* Configure LED1 and LED3 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED3);
/*##-1- Link the USB Host disk I/O driver ##################################*/
if(FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == 0)
{
/*##-2- Init Host Library ################################################*/
USBH_Init(&hUSB_Host, USBH_UserProcess, 0);
/*##-3- Add Supported Class ##############################################*/
USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS);
/*##-4- Start Host Process ###############################################*/
USBH_Start(&hUSB_Host);
/*##-5- Run Application (Blocking mode) ##################################*/
while (1)
{
/* USB Host Background task */
USBH_Process(&hUSB_Host);
/* Mass Storage Application State Machine */
switch(Appli_state)
{
case APPLICATION_START:
MSC_Application();
Appli_state = APPLICATION_IDLE;
break;
case APPLICATION_IDLE:
default:
break;
}
}
}
/* Infinite loop */
while (1)
{
}
}
示例12: pyb_usb_host_init
void pyb_usb_host_init(void) {
if (!host_is_enabled) {
// only init USBH once in the device's power-lifetime
/* Init Host Library */
USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &HID_cb, &USR_Callbacks);
}
host_is_enabled = 1;
}
示例13: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* Configure Key Button */
BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
/* Unlock the Flash to enable the flash control register access */
FLASH_If_FlashUnlock();
/* Test if User button on the STM324x9I_EVAL is pressed */
if (BSP_PB_GetState(BUTTON_KEY) != GPIO_PIN_RESET)
{
/* Check Vector Table: Test if user code is programmed starting from address
"APPLICATION_ADDRESS" */
if ((((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFF000000 ) == 0x20000000) || \
(((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFF000000 ) == 0x10000000))
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
Jump_To_Application();
}
}
/* 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();
/* Init FW upgrade Application */
FW_InitApplication();
/* Init Host Library */
USBH_Init(&hUSBHost, USBH_UserProcess, 0);
/* Add Supported Class */
USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS);
/* Start Host Process */
USBH_Start(&hUSBHost);
/* Run Application (Blocking mode)*/
while (1)
{
/* USB Host Background task */
USBH_Process(&hUSBHost);
/* FW Menu Process */
FW_UPGRADE_Process();
}
}
示例14: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* STM32F4xx HAL library initialization */
HAL_Init();
/* Configure the system clock to 180 Mhz */
SystemClock_Config();
/* Initialize IO expander */
BSP_IO_Init();
/* Init Dual Core Application */
DUAL_InitApplication();
/* Init HS Core */
USBH_Init(&hUSBHost_HS, USBH_HS_UserProcess, 1);
/* Init FS Core */
USBH_Init(&hUSBHost_FS, USBH_FS_UserProcess, 0);
/* Add Supported Classes */
USBH_RegisterClass(&hUSBHost_HS, USBH_MSC_CLASS);
USBH_RegisterClass(&hUSBHost_FS, USBH_HID_CLASS);
/* Start Host Process */
USBH_Start(&hUSBHost_FS);
USBH_Start(&hUSBHost_HS);
/* Register the file system object to the FatFs module */
if(f_mount(&USBH_fatfs, "", 0) != FR_OK)
{
LCD_ErrLog("ERROR : Cannot Initialize FatFs! \n");
}
/* Run Application (Blocking mode)*/
while (1)
{
/* USB Host Background tasks */
USBH_Process(&hUSBHost_FS);
USBH_Process(&hUSBHost_HS);
/* DUAL Menu Process */
DUAL_MenuProcess();
}
}
示例15: MX_USB_HOST_Init
/* init function */
void MX_USB_HOST_Init(void)
{
/* Init Host Library,Add Supported Class and Start the library*/
USBH_Init(&hUsbHostFS, USBH_UserProcess, HOST_FS);
USBH_RegisterClass(&hUsbHostFS, USBH_MSC_CLASS);
USBH_Start(&hUsbHostFS);
}