/** * @brief Manages DS Menu Process. * @param None * @retval None */ void DS_MenuProcess(void) { switch(Appli_state) { case APPLICATION_IDLE: break; case APPLICATION_MSC: MSC_MenuProcess(); break; case APPLICATION_AUDIO: AUDIO_MenuProcess(); break; case APPLICATION_HID: HID_MenuProcess(); break; default: break; } if(Appli_state == APPLICATION_DISCONNECT) { Appli_state = APPLICATION_IDLE; Menu_Init(); /* Unlink the micro SD disk I/O driver */ FATFS_UnLinkDriver(SD_Path); /* Unlink the USB disk I/O driver */ FATFS_UnLinkDriver(USBDISKPath); } }
/** * @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 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(); /* 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 */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* 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 Manages DUAL Menu Process. * @param None * @retval None */ void DUAL_MenuProcess(void) { switch(demo.state) { case DEMO_IDLE: Demo_SelectItem(DEMO_main_menu, 0); LCD_UsrLog("Select an operation to continue.\n"); demo.state = DEMO_WAIT; demo.select = 0; break; case DEMO_WAIT: if(demo.select != prev_select) { prev_select = demo.select; Demo_SelectItem(DEMO_main_menu, demo.select & 0x7F); /* Handle select item */ if(demo.select & 0x80) { demo.select &= 0x7F; switch(demo.select) { case 0: demo.state = DEMO_MSC_START; break; case 1: demo.state = DEMO_HID_START; break; case 2: demo.state = DEMO_MSC_REENUMERATE; break; case 3: demo.state = DEMO_HID_REENUMERATE; break; default: break; } } } break; case DEMO_MSC_START: if(Appli_HS_state == APPLICATION_HS_READY) { /* If HS device connected*/ demo.state = DEMO_MSC; demo.msc_state = APPLI_MSC_IDLE; } else { LCD_ErrLog("No Mass storage device connected.\n"); demo.state = DEMO_WAIT; } break; case DEMO_HID_START: if(Appli_FS_state == APPLICATION_FS_READY) { /*if FS device connected*/ demo.state = DEMO_HID; demo.hid_state = APPLI_HID_IDLE; } else { LCD_ErrLog("No HID device connected.\n"); demo.state = DEMO_WAIT; } break; case DEMO_MSC: MSC_MenuProcess(); break; case DEMO_HID: HID_MenuProcess(); break; case DEMO_MSC_REENUMERATE: /* Re-Enumeration MSC */ LCD_DbgLog("Starting Enumeration MSC...."); LCD_DbgLog("\n"); USBH_ReEnumerate(&hUSBHost_HS); demo.state = DEMO_WAIT; break; case DEMO_HID_REENUMERATE: /* Re-Enumeration HID */ LCD_DbgLog("Starting Enumeration HID...."); LCD_DbgLog("\n"); USBH_ReEnumerate(&hUSBHost_FS); demo.state = DEMO_WAIT; break; default: break; } if(Appli_FS_state == APPLICATION_FS_DISCONNECT) { Appli_FS_state = APPLICATION_IDLE; LCD_LOG_ClearTextZone(); LCD_ErrLog("device FS disconnected!\n"); demo.state = DEMO_IDLE; demo.select = 0; } if(Appli_HS_state == APPLICATION_HS_DISCONNECT) { Appli_HS_state = APPLICATION_IDLE; LCD_LOG_ClearTextZone(); LCD_ErrLog("device HS disconnected!\n"); demo.state = DEMO_IDLE; demo.select = 0; } }