/** * @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(); } }
/** * @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); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F469xx HAL library initialization */ HAL_Init(); /* Configure the System clock to have a frequency of 180 MHz */ SystemClock_Config(); /* Init Dynamic Switch Application */ DynamicSwitch_InitApplication(); /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS); USBH_RegisterClass(&hUSBHost, USBH_HID_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); while (1) { /* USB Host Background task */ USBH_Process(&hUSBHost); /* DS Menu Process */ DS_MenuProcess(); } }
/** * @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(); } }
/** * @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(); } }
/** * @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(); } }
/** * @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) { } }
/** * @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(); } }
/** * @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(); } }
/* 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); }
/** * @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 STM32446E_EVAL is pressed */ if (BSP_PB_GetState(BUTTON_KEY) != GPIO_PIN_SET) { /* Check Vector Table: Test if user code is programmed starting from address "APPLICATION_ADDRESS" */ if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0xFF000000 ) == 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(); } } /* STM32F446xx HAL library initialization */ HAL_Init(); /* Configure the system clock to 180 Mhz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* 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(); } }
/** * @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 LED3 and LED4 */ BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure USER Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Initialize LCD driver */ LCD_Config(); /* Link the USB Host disk I/O driver */ USBDISK_Driver_Num = FATFS_LinkDriver(&USBH_Driver, ""); /* Init Host Library */ if (USBH_Init(&hUSB_Host, USBH_UserProcess, 0) != USBH_OK) { /* USB Initialization Error */ Error_Handler(); } /* Add Supported Class */ USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS); /* Start Host Process */ if (USBH_Start(&hUSB_Host) != USBH_OK) { /* USB Initialization Error */ Error_Handler(); } /* Infinite loop */ while (1) { if (Appli_state == APPLICATION_START) { MSC_Application(); } Toggle_Leds(); USBH_Process(&hUSB_Host); } }
//------------------------------------------------------------------------------------------------------------------------------------------------------ void FDrive_Init(void) { if(FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == FR_OK) { USBH_StatusTypeDef res = USBH_Init(&handleUSBH, USBH_UserProcess, 0); res = USBH_RegisterClass(&handleUSBH, USBH_MSC_CLASS); res = USBH_Start(&handleUSBH); } else { LOG_ERROR("Can not %s", __FUNCTION__); } }
//------------------------------------------------------------------------------------------------------------------------------------------------------ void FDrive_Init(void) { if(FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == FR_OK) { USBH_StatusTypeDef res = USBH_Init(&handleUSBH, USBH_UserProcess, 0); res = USBH_RegisterClass(&handleUSBH, USBH_MSC_CLASS); res = USBH_Start(&handleUSBH); } else { // —юда попадаем, если usbh driver не удалось инициализировать } }
/** * @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 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 200 MHz */ SystemClock_Config(); /* Init Audio Application */ AUDIO_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); /* AUDIO Menu Process */ AUDIO_MenuProcess(); if ( MfxToggleLed == 1) { #if defined(USE_STM32756G_EVAL_REVA) /* On RevA board, as LED1 is connected to MFX, the toggle is performed in main loop */ BSP_LED_Toggle(LED1); #else /* On RevB board, as LED1 is connected to GPIO, it is toggled in ISR, * the LED4 is toggled in main loop as it is connected to MFX */ BSP_LED_Toggle(LED4); #endif MfxToggleLed = 0; } } }
void _usb_msc_host_init(unsigned int instance, new_gpio* StatusLed) { //if(FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == 0) //{ /*##-2- Init Host Library ################################################*/ USBH_Init(&usb_msc_host_param[instance], USBH_UserProcess, 0); /*##-3- Add Supported Class ##############################################*/ USBH_RegisterClass(&usb_msc_host_param[instance], USBH_MSC_CLASS); /*##-4- Start Host Process ###############################################*/ USBH_Start(&usb_msc_host_param[instance]); //} }
void MY_USBH_Init(void) { /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ /* highest priority first */ USBH_RegisterClass(&hUSBHost, USBH_VENDOR_CLASS); USBH_RegisterClass(&hUSBHost, USBH_MIDI_CLASS); USBH_RegisterClass(&hUSBHost, USBH_HID_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); }
/** * @brief Start task * @param pvParameters not used * @retval None */ static void StartThread(void const * argument) { osEvent event; /* Init MSC Application */ MSC_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); /* Register the file system object to the FatFs module */ if(f_mount(&USBH_fatfs, "", 0) != FR_OK) { LCD_ErrLog("ERROR : Cannot Initialize FatFs! \n"); } for( ;; ) { event = osMessageGet(AppliEvent, osWaitForever); if(event.status == osEventMessage) { switch(event.value.v) { case APPLICATION_DISCONNECT: Appli_state = APPLICATION_DISCONNECT; osSemaphoreRelease(MenuEvent); break; case APPLICATION_READY: Appli_state = APPLICATION_READY; default: break; } } } }
/** * @brief HCD_ReEnumerate * Perform a new Enumeration phase. * @param phost: Host Handle * @retval USBH Status */ USBH_StatusTypeDef USBH_ReEnumerate (USBH_HandleTypeDef *phost) { /*Stop Host */ USBH_Stop(phost); /*Device has disconnected, so wait for 200 ms */ USBH_Delay(200); /* Set State machines in default state */ DeInitStateMachine(phost); /* Start again the host */ USBH_Start(phost); #if (USBH_USE_OS == 1) osMessagePut ( phost->os_event, USBH_PORT_EVENT, 0); #endif return USBH_OK; }
/** * @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(); /* Initialize IO expander */ BSP_IO_Init(); /* Init CDC Application */ CDC_InitApplication(); /* Init Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_CDC_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); /* Run Application (Blocking mode) */ while (1) { /* USB Host Background task */ USBH_Process(&hUSBHost); /* CDC Menu Process */ CDC_MenuProcess(); } }
/** * @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); /* Init Host Library */ USBH_Init(&hUSB_Host, USBH_UserProcess, 0); /* Create USB background task */ osThreadDef(STORAGE_Thread, StorageThread, osPriorityLow, 0, 64); osThreadCreate (osThread(STORAGE_Thread), NULL); /* Create Storage Message Queue */ osMessageQDef(osqueue, 10, uint16_t); StorageEvent = osMessageCreate (osMessageQ(osqueue), NULL); /* Add Supported Class */ USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS); /* Start Host Process */ USBH_Start(&hUSB_Host); }
/** * @brief Start task * @param pvParameters not used * @retval None */ static void StartThread(void const *argument) { osEvent event; /* Link the USB Host disk I/O driver */ if(FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == 0) { /* 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); for( ;; ) { event = osMessageGet(AppliEvent, osWaitForever); if(event.status == osEventMessage) { switch(event.value.v) { case CONNECTION_EVENT: MSC_Application(); break; case DISCONNECTION_EVENT: f_mount(NULL, (TCHAR const*)"", 0); break; default: break; } } } } }
int main(void) { HAL_Init(); led_all_init(); SystemClock_Config(); if (BSP_ACCELERO_Init() != ACCELERO_OK) { Error_Handler(); } BSP_ACCELERO_Click_ITConfig(); TIM_LED_Config(); isLooping = 1; ledState = LEDS_OFF; BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); // Link the USB Host disk I/O driver if (FATFS_LinkDriver(&USBH_Driver, usbDrivePath) == 0) { USBH_Init(&hUSBHost, usbUserProcess, 0); USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS); USBH_Start(&hUSBHost); while (1) { switch (appState) { case APP_START: startApp(); break; case APP_IDLE: default: break; } USBH_Process(&hUSBHost); } } while (1) { } }
/** * @brief Start task * @param pvParameters not used * @retval None */ static void StartThread(void const * argument) { osEvent event; /* Init HID Application */ HID_InitApplication(); /* Start Host Library */ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSBHost, USBH_HID_CLASS); /* Start Host Process */ USBH_Start(&hUSBHost); for( ;; ) { event = osMessageGet( AppliEvent, osWaitForever ); if( event.status == osEventMessage ) { switch(event.value.v) { case APPLICATION_DISCONNECT: Appli_state = APPLICATION_DISCONNECT; HID_UpdateMenu(); break; case APPLICATION_READY: Appli_state = APPLICATION_READY; default: break; } } } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F469xx HAL library initialization */ HAL_Init(); /* Configure the System clock to have a frequency of 180 MHz */ SystemClock_Config(); /* Init MSC Application */ MSC_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); /* 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 task */ USBH_Process(&hUSBHost); /* MSC Menu Process */ MSC_MenuProcess(); } }
/** * @brief Main program. * @param None * @retval None */ int main(void) { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock to 72 Mhz */ SystemClock_Config(); /* Init MSC Application */ MSC_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); /* 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 task */ USBH_Process(&hUSBHost); /* MSC Menu Process */ MSC_MenuProcess(); } }
/** * @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 LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- 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); /*##-2- Configure Tamper button ############################################*/ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /*##-3- Link the USB Host disk I/O driver ##################################*/ FATFS_LinkDriver(&USBH_Driver, MSC_Path); /*##-4- Initialize the SRAM and LCD ########################################*/ BSP_LCD_Init(); BSP_SRAM_Init(); /*##-5- Camera Initialization and start capture ############################*/ /* Initialize the Camera */ BSP_CAMERA_Init(RESOLUTION_R320x240); /* Start the Camera Capture */ BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER); /*##-6- Run Application ####################################################*/ while (1) { /* USB Host Background task */ USBH_Process(&hUSB_Host); switch(Appli_state) { case STORAGE_READY: CAMERA_Capture(); break; case STORAGE_IDLE: default: break; } } }
/** * @brief Main program * @param None * @retval None */ int main(void) { uint8_t lcd_status = LCD_OK; p_bmp_converted_pixel_data = (uint8_t *)CONVERTED_FRAME_BUFFER; offset_address_area_cam_in_lcd_buffer = ((((LcdResY - CameraResY) / 2) * LcdResX) + ((LcdResX - CameraResX) / 2)) * ARGB8888_BYTE_PER_PIXEL; /* For the first Camera line event callback : set the offset to display camera image in the center */ /* of LCD frame buffer background */ lcd_datapointer = offset_address_area_cam_in_lcd_buffer; /* 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(); BSP_IO_Init(); /* Reset and power down camera to be sure camera is Off prior start testing BSP */ BSP_CAMERA_HwReset(); BSP_CAMERA_PwrDown(); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- LCD DSI initialization in mode Video Burst with two LTDC layers of size 800x480 */ lcd_status = BSP_LCD_Init(); if(lcd_status != LCD_OK) { Error_Handler(); } BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER_BACKGROUND, LCD_BG_LAYER_ADDRESS); BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER_FOREGROUND, LCD_FB_START_ADDRESS); /* Select Foreground Layer */ BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_FOREGROUND); /* Clear the LCD Foreground layer */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Disable the LTDC Foreground layer */ BSP_LCD_SetLayerVisible(LTDC_ACTIVE_LAYER_FOREGROUND, DISABLE); /* Select the LCD Background layer */ BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_BACKGROUND); BSP_LCD_Clear(LCD_COLOR_WHITE); /*##-2- Init Host Library ##################################################*/ /* Display USB initialization message */ BSP_LCD_SetTextColor(LCD_COLOR_DARKBLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(20, (BSP_LCD_GetYSize() - 24), (uint8_t *)"USB init ..", RIGHT_MODE); USBH_Init(&hUSB_Host, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS); /* Start Host Process */ USBH_Start(&hUSB_Host); /*##-3- Configure TAMPER Button ############################################*/ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /*##-4- Link the USB Host disk I/O driver ##################################*/ FATFS_LinkDriver(&USBH_Driver, MSC_Path); /*##-5- Camera Initialization and start capture ############################*/ /* Display camera initialization message */ BSP_LCD_DisplayStringAt(20, (BSP_LCD_GetYSize() - 24), (uint8_t *)"Camera init ..", RIGHT_MODE); /* Initialize the Camera */ BSP_CAMERA_Init(RESOLUTION_R480x272); /* Start the Camera Capture */ BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER); BSP_LCD_DisplayStringAt(20, (BSP_LCD_GetYSize() - 48), (uint8_t *)"Press TAMPER button to take snapshot", RIGHT_MODE); BSP_LCD_DisplayStringAt(20, (BSP_LCD_GetYSize() - 24), (uint8_t *)"Camera Play ..", RIGHT_MODE); /*##-6- Run Application ####################################################*/ while (1) { /* USB Host Background task */ USBH_Process(&hUSB_Host); switch(Appli_state) { case STORAGE_READY: CAMERA_Capture(); break; case STORAGE_IDLE: break; } } }
/** * @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 LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- 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); /*##-2- Disable SAI1_SDA signal ############################################*/ /* Note: In STM324x9I-EVAL RevB, PE6 pin is shared between data_7 of camera and SAI1_SDA of codec WM8994, after power on, SAI1_SDA pin of codec WM8994 is in output state, thus preventing MCU from receiving correct signal from camera, so we need to configure SAI1_SDA pin of codec WM8994 in tri-state */ /* Initialize the Control interface of the Audio Codec */ BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_SPEAKER, 70, AUDIO_FREQUENCY_48K); /* ADCDAT1 is tri-stated */ AUDIO_IO_Write(AUDIO_I2C_ADDRESS, 0x200, 0); AUDIO_IO_Write(AUDIO_I2C_ADDRESS, 0x300, 0x6010); /*##-3- Configure TAMPER Button ############################################*/ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /*##-4- Link the USB Host disk I/O driver ##################################*/ FATFS_LinkDriver(&USBH_Driver, MSC_Path); /*##-5- Initialize the LCD #################################################*/ BSP_LCD_Init(); /* Foreground Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER_LAYER1); /* Set Foreground Layer */ BSP_LCD_SelectLayer(1); /* Clear the LCD Foreground layer */ BSP_LCD_Clear(LCD_COLOR_WHITE); BSP_LCD_SetLayerVisible(1, DISABLE); /* Background Layer Initialization */ BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER); /* Enable the LCD */ BSP_LCD_DisplayOn(); /* Select the LCD Foreground layer */ BSP_LCD_SelectLayer(0); BSP_LCD_Clear(LCD_COLOR_WHITE); /*##-6- Camera Initialization and start capture ############################*/ /* Initialize the Camera */ BSP_CAMERA_Init(RESOLUTION_R480x272); /* Start the Camera Capture */ BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER); /*##-7- Run Application ####################################################*/ while (1) { /* USB Host Background task */ USBH_Process(&hUSB_Host); switch(Appli_state) { case STORAGE_READY: CAMERA_Capture(); break; case STORAGE_IDLE: break; } } }
/** * @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 LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- LCD Initialization #################################################*/ /* Initialize the LCD */ BSP_LCD_Init(); /* Foreground Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER_LAYER1); /* Set Foreground Layer */ BSP_LCD_SelectLayer(1); /* Clear the LCD Foreground layer */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Enable the color Key for foreground layer */ BSP_LCD_SetColorKeying(1, LCD_COLOR_WHITE); BSP_LCD_SetLayerVisible(1, DISABLE); /* Background Layer Initialization */ BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER_LAYER0); /* Set Foreground Layer */ BSP_LCD_SelectLayer(0); /* Enable the LCD */ BSP_LCD_DisplayOn(); /* Clear the LCD Background layer */ BSP_LCD_Clear(LCD_COLOR_WHITE); /*##-2- Touch screen initialization ########################################*/ Touchscreen_Calibration(); /*##-3- USB Initialization #################################################*/ /* Init Host Library */ if (USBH_Init(&hUSB_Host, USBH_UserProcess, 0) != USBH_OK) { /* USB Initialization Error */ Error_Handler(); } /* Add Supported Class */ USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS); /* Start Host Process */ if (USBH_Start(&hUSB_Host) != USBH_OK) { /* USB Initialization Error */ Error_Handler(); } /*##-4- Link the USB Mass Storage disk I/O driver ##########################*/ if(FATFS_LinkDriver(&USBH_Driver, USB_Path) != 0) { /* FatFs Initialization Error */ Error_Handler(); } /*##-5- Register the file system object to the FatFs module ################*/ if(f_mount(&USBDISK_FatFs, (TCHAR const*)USB_Path, 0) != FR_OK) { /* FatFs Initialization Error */ Error_Handler(); } /*##-6- Draw the menu ######################################################*/ Draw_Menu(); /* Infinite loop */ while (1) { /*##-7- Configure the touch screen and Get the position ##################*/ GetPosition(); USBH_Process(&hUSB_Host); } }