/** * @brief Main program. * @param None * @retval None */ int main(void) { /* Initialize LEDS */ STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); STM_EVAL_LEDInit(LED5); STM_EVAL_LEDInit(LED6); /* Green Led On: start of application */ STM_EVAL_LEDOn(LED4); /* SysTick end of count event each 10ms */ RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 100); /* Configure TIM4 Peripheral to manage LEDs lighting */ TIM_LED_Config(); /* Initialize the repeat status */ RepeatState = 0; LED_Toggle = 7; #if defined MEDIA_IntFLASH WavePlayBack(I2S_AudioFreq_48k); while (1); #elif defined MEDIA_USB_KEY /* Initialize User Button */ STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_EXTI); /* Init Host Library */ USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks); IT_Lines_Init(); while (1) { /* Host Task handler */ USBH_Process(&USB_OTG_Core, &USB_Host); } #endif }
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 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 LED3, LED4, LED5 and LED6 */ BSP_LED_Init(LED3); BSP_LED_Init(LED4); BSP_LED_Init(LED5); BSP_LED_Init(LED6); /* Configure the system clock to 84 MHz */ SystemClock_Config(); /* Initialize MEMS Accelerometer mounted on STM32F4-Discovery board */ if(BSP_ACCELERO_Init() != ACCELERO_OK) { /* Initialization Error */ Error_Handler(); } /* Enable click config for pause/play */ BSP_ACCELERO_Click_ITConfig(); /* Turn ON LED4: start of application */ BSP_LED_On(LED4); /* Configure TIM4 Peripheral to manage LEDs lighting */ TIM_LED_Config(); /* Turn OFF all LEDs */ LEDsState = LEDS_OFF; /* Initialize User Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /*##-1- Link the USB Host disk I/O driver ##################################*/ application_init(); /*##-2- Init Host Library ################################################*/ USBH_Init(&hUSBHost, USBH_UserProcess, 0); /*##-3- Add Supported Class ##############################################*/ USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS); /*##-4- Start Host Process ###############################################*/ USBH_Start(&hUSBHost); /* Run Application (Blocking mode)*/ while (1) { application_task(); /* USBH_Background Process */ USBH_Process(&hUSBHost); } }