/** * @brief DS application Init. * @param None * @retval None */ static void DynamicSwitch_InitApplication(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure KEY Button */ BSP_PB_Init(BUTTON_WAKEUP, BUTTON_MODE_GPIO); /* Initialize the LCD */ BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(0); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG FS DynamicSwitch Host"); LCD_UsrLog("USB Host library started.\n"); /* Start Dynamic Switch Interface */ LCD_UsrLog("Starting DynamicSwitch Demo\n"); LCD_UsrLog("Plug your device To Continue...\n"); }
/** * @brief USBH_USR_Init * Displays the message on LCD for host lib initialization * @param None * @retval None */ void USBH_USR_Init(void) { static uint8_t startup = 0; if(startup == 0 ) { startup = 1; /* Configure the LEDs */ STM_EVAL_LEDInit(LED1); STM_EVAL_LEDInit(LED2); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO); #ifdef USE_STM3210C_EVAL STM3210C_LCD_Init(); #else STM322xG_LCD_Init(); #endif LCD_LOG_Init(); #ifdef USE_USB_OTG_HS LCD_LOG_SetHeader(" USB OTG HS HID Host"); #else LCD_LOG_SetHeader(" USB OTG FS HID Host"); #endif LCD_UsrLog("> USB Host library started.\n"); LCD_LOG_SetFooter (" USB Host Library v2.0.0" ); } }
/** * @brief DS application Init. * @param None * @retval None */ static void DynamicSwitch_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB HS DynamicSwitch Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB FS DynamicSwitch Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start Dynamic Switch Interface */ LCD_UsrLog("Starting DynamicSwitch Demo\n"); LCD_UsrLog("Plug your device To Continue...\n"); }
/** * @brief MSC application Init. * @param None * @retval None */ static void MSC_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MSC Host"); LCD_UsrLog("USB Host library started.\n"); /* Start MSC Interface */ USBH_UsrLog("Starting MSC Demo"); Menu_Init(); }
/** * @brief MSC application Init. * @param None * @retval None */ static void MSC_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(0); /* Init the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS MSC Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MSC Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Initialize menu and MSC process */ USBH_UsrLog("Starting MSC Demo"); Menu_Init(); }
/** * @brief DS application Init. * @param None * @retval None */ static void DynamicSwitch_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /* Configure LED1 */ BSP_LED_Init(LED1); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Selects the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enables the display */ BSP_LCD_DisplayOn(); /* Init the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB HS DynamicSwitch Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB FS DynamicSwitch Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start Dynamic Switch Interface */ LCD_UsrLog("Starting DynamicSwitch Demo\n"); LCD_UsrLog("Plug your device To Continue...\n"); }
/** * @brief DUALCORE application Init. * @param None * @retval None */ static void DUAL_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /* Configure LED1 */ BSP_LED_Init(LED1); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Selects the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enables the display */ BSP_LCD_DisplayOn(); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG DualCore Host"); LCD_UsrLog("USB Host library started.\n"); /* Start DualCore Interface */ USBH_UsrLog("Initializing hardware...."); DUAL_MenuInit(); }
/** * @brief Displays the message on LCD on device lib initialization * @param None * @retval None */ void USBD_USR_Init(void) { /* Initialize LEDs */ STM_EVAL_LEDInit(LED4); /* Init LCD */ STM32f4_Discovery_LCD_Init(); LCD_LOG_Init(); #ifdef USE_USB_OTG_HS LCD_LOG_SetHeader(" USB OTG HS MSC Device"); #else LCD_LOG_SetHeader(" USB OTG FS MSC Device"); #endif LCD_UsrLog("> USB device library started.\n"); LCD_LOG_SetFooter (" USB Device Library v1.1.0" ); /* Information panel */ LCD_SetTextColor(Green); LCD_DisplayStringLine( LCD_PIXEL_HEIGHT - 42, USER_INFORMATION1); LCD_DisplayStringLine( LCD_PIXEL_HEIGHT - 30, USER_INFORMATION2); LCD_SetTextColor(LCD_LOG_DEFAULT_COLOR); }
/** * @brief HID application Init. * @param None * @retval None */ static void HID_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS HID Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS HID Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start HID Interface */ USBH_UsrLog("Starting HID Demo"); HID_MenuInit(); }
/** * @brief HID application Init. * @param None * @retval None */ static void HID_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI); /* Configure LED1*/ BSP_LED_Init(LED1); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Select the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enable the display */ BSP_LCD_DisplayOn(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS HID Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS HID Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start HID Interface */ USBH_UsrLog("Starting HID Demo"); HID_MenuInit(); }
/** * @brief MSC application Init. * @param None * @retval None */ static void MSC_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_WAKEUP, BUTTON_MODE_EXTI); /* Configure LED1 */ BSP_LED_Init(LED1); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Select the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enable the display */ BSP_LCD_DisplayOn(); /* Initialize the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MSC Host"); LCD_UsrLog("USB Host library started.\n"); /* Initialize menu and MSC process */ Menu_Init(); }
/** * @brief DUALCORE application Init. * @param None * @retval None */ static void DUAL_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG DualCore Host"); LCD_UsrLog("USB Host library started.\n"); /* Start DualCore Interface */ USBH_UsrLog("Initializing hardware...."); DUAL_MenuInit(); }
/** * @brief CDC application Init * @param None * @retval None */ static void CDC_InitApplication(void) { /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure KEY Button */ BSP_PB_Init(BUTTON_WAKEUP, BUTTON_MODE_GPIO); /* Initialize the LCD */ BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(0); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)" USB OTG FS CDC Host"); LCD_UsrLog("USB Host library started.\n"); /* Start CDC Interface */ USBH_UsrLog("Starting CDC Demo"); Menu_Init(); }
/** * @brief MSC application Init. * @param None * @retval None */ static void MSC_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Initialize the LCD */ BSP_LCD_Init(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS MSC Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MSC Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Initialize menu and MSC process */ USBH_UsrLog("Starting MSC Demo"); Menu_Init(); }
/** * @brief HID application Init * @param None * @retval None */ static void HID_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Initialize the LCD */ BSP_LCD_Init(); /* Init the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS HID Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS HID Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start HID Interface */ HID_MenuInit(); }
/** * @brief USBD_USR_Init * Displays the message on LCD for host lib initialization * @param None * @retval None */ void USBD_USR_Init(void) { /* Initialize LEDs */ STM_EVAL_LEDInit(LED1); STM_EVAL_LEDInit(LED2); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); /* Initialize the LCD */ #if defined (USE_STM322xG_EVAL) STM322xG_LCD_Init(); #elif defined(USE_STM324xG_EVAL) STM324xG_LCD_Init(); #elif defined (USE_STM3210C_EVAL) STM3210C_LCD_Init(); #else #error "Missing define: Evaluation board (ie. USE_STM322xG_EVAL)" #endif LCD_LOG_Init(); #ifdef USE_USB_OTG_HS LCD_LOG_SetHeader(" USB OTG HS DFU Device"); #else LCD_LOG_SetHeader(" USB OTG FS DFU Device"); #endif LCD_UsrLog("> USB device library started.\n"); LCD_LOG_SetFooter (" USB Device Library v1.1.0" ); /* Information panel */ LCD_SetTextColor(Green); LCD_DisplayStringLine( LCD_PIXEL_HEIGHT - 30, USER_INFORMATION1); LCD_SetTextColor(LCD_LOG_DEFAULT_COLOR); }
/** * @brief LCD Log demo * @param None * @retval None */ void Log_demo(void) { JOYState_TypeDef JoyState = JOY_NONE; uint8_t i = 0; /* Wait For User inputs */ while(CheckForUserInput() == 0); BSP_JOY_Init(JOY_MODE_GPIO); /* Initialize LCD Log module */ LCD_LOG_Init(); /* Show Header and Footer texts */ LCD_LOG_SetHeader((uint8_t *)"Log Example"); LCD_LOG_SetFooter((uint8_t *)"Use Joystick to scroll up/down"); /* Output User logs */ for (i = 0; i < 10; i++) { LCD_UsrLog ("This is Line %d \n", i); } HAL_Delay(2000); /* Clear Old logs */ LCD_LOG_ClearTextZone(); /* Output new user logs */ for (i = 0; i < 30; i++) { LCD_UsrLog ("This is Line %d \n", i); } /* Check for joystick user input for scroll (back and forward) */ while (1) { JoyState = BSP_JOY_GetState(); switch(JoyState) { case JOY_UP: LCD_LOG_ScrollBack(); break; case JOY_DOWN: LCD_LOG_ScrollForward(); break; default: break; } if(CheckForUserInput() > 0) { return; } HAL_Delay (10); } }
/** * @brief Audio Application Init. * @param None * @retval None */ static void AUDIO_InitApplication(void) { uint8_t lcd_status = LCD_OK; /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure the LED1, LED2, LED3 and LED4 */ BSP_IO_Init(); BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Initialize the SDRAM */ if (BSP_SDRAM_Init() != SDRAM_OK) { /* User can add here some code to deal with this error */ while (1) { } } /* Initialize and start the LCD display in mode 'lcd_mode' * Using LCD_FB_START_ADDRESS as frame buffer displayed contents. * This buffer is modified by the BSP (draw fonts, objects depending on BSP calls). */ /* Set Portrait orientation if needed, by default orientation is set to Landscape */ /* Initialize DSI LCD */ // BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT); /* uncomment if Portrait orientation is needed */ BSP_LCD_Init(); /* Uncomment if default config (landscape orientation) is needed */ while(lcd_status != LCD_OK); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_SelectLayer(0); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"Audio Playback and Record Application"); LCD_UsrLog("USB Host library started.\n"); /* Start Audio interface */ USBH_UsrLog("Starting Audio Demo"); /* Init Audio interface */ AUDIO_PLAYER_Init(); /* Start Audio interface */ AUDIO_MenuInit(); }
/** * @brief Audio Application Init. * @param None * @retval None */ static void AUDIO_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure IO and LED1 */ BSP_IO_Init(); BSP_LED_Init(LED1); BSP_LED_Init(LED4); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Camera has to be powered down as some signals use same GPIOs between * I2S signals and camera bus. Camera drives its signals to low impedance * when powered ON. So the camera is powered off to let its signals * in high impedance */ /* Camera power down sequence */ BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT); BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT); /* De-assert the camera STANDBY pin (active high) */ BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET); /* Assert the camera RSTI pin (active low) */ BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Select the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enable the display */ BSP_LCD_DisplayOn(); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"Audio Playback and Record Application"); LCD_UsrLog("USB Host library started.\n"); /* Start Audio interface */ USBH_UsrLog("Starting Audio Demo"); /* Init Audio interface */ AUDIO_PLAYER_Init(); /* Start Audio interface */ AUDIO_MenuInit(); }
/** * @brief Image browser * @param path: pointer to root path * @retval None */ static uint8_t Image_Browser(char *path) { FRESULT res; uint8_t ret = 1; FILINFO fno; DIR dir; char *fn; res = f_opendir(&dir, path); if (res != FR_OK) { Error_Handler(); } else { for (;;) { res = f_readdir(&dir, &fno); if (res != FR_OK || fno.fname[0] == 0) break; if (fno.fname[0] == '.') continue; fn = fno.fname; if (fno.fattrib & AM_DIR) { continue; } else { if((strstr(fn, "bmp")) || (strstr(fn, "BMP"))) { res = f_open(&file, fn, FA_OPEN_EXISTING | FA_READ); Show_Image(); USBH_Delay(100); ret = 0; while((Appli_state == APPLICATION_START) && \ (BSP_PB_GetState (BUTTON_KEY) != SET)) { Toggle_Leds(); } f_close(&file); } } } } /* LCD Log initialization */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"LTDC Application"); LCD_LOG_SetFooter ((uint8_t *)" USB Host Library V3.2.0" ); USBH_USR_ApplicationState = USH_USR_FS_READLIST; f_closedir(&dir); return ret; }
/** * @brief Program entry point * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32fxxx_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32fxxx.c file */ /* Initialize the LCD */ STM32f4_Discovery_LCD_Init(); LCD_LOG_Init(); LCD_LOG_SetHeader(" Binary image template "); LCD_UsrLog("> Systick template example started.\n"); LCD_LOG_SetFooter (" Binary image template " ); /* Configure the LEDs */ STM_EVAL_LEDInit(LED4); /* Set the Vector Table base location at the application start address (this is already done in system_stm32fxxx.c file) */ //#ifdef STM32F2XX // /* Set the Vector Table base location at 0xC000 */ // NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0xC000); //#elif defined(STM32F4XX) // /* Set the Vector Table base location at 0xC000 */ // NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0xC000); //#elif defined(STM32F10X_CL) // /* Set the Vector Table base location at 0x8000 */ // NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x8000); //#endif /* STM32F2XX */ /* SysTick end of count event each 10ms */ RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000); while (1) { /* Toggle all leds */ STM_EVAL_LEDToggle(LED4); /* Insert 200 ms delay */ Delay(200); /* Toggle all leds */ STM_EVAL_LEDToggle(LED4); /* Insert 200 ms delay */ Delay(200); } }
/** * @brief Initializes the STM324x9I-EVAL's LCD and LEDs resources. * @param None * @retval None */ static void BSP_Config(void) { #ifdef USE_LCD uint8_t lcd_status = LCD_OK; #endif /* USE_LCD */ /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Init MFX IO Expander */ BSP_IO_Init(); /* Enable MFX IO Expander interrupt for ETH MII pin */ BSP_IO_ConfigPin(MII_INT_PIN, IO_MODE_IT_FALLING_EDGE); #ifdef USE_LCD /* Initialize and start the LCD display in mode 'lcd_mode' * Using LCD_FB_START_ADDRESS as frame buffer displayed contents. * This buffer is modified by the BSP (draw fonts, objects depending on BSP calls). */ /* Set Portrait orientation if needed, by default orientation is set to Landscape */ /* Initialize DSI LCD */ // BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT); /* uncomment if Portrait orientation is needed */ BSP_LCD_Init(); /* Uncomment if default config (landscape orientation) is needed */ while(lcd_status != LCD_OK); BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_SetFont(&LCD_DEFAULT_FONT); /* Initialize LCD Log module */ LCD_LOG_Init(); /* Show Header and Footer texts */ LCD_LOG_SetHeader((uint8_t *)"Webserver Application Netconn API"); LCD_LOG_SetFooter((uint8_t *)"STM32469I-EVAL board"); LCD_UsrLog ((char *)" State: Ethernet Initialization ...\n"); #endif /* USE_LCD */ }
/** * @brief CDC application Init. * @param None * @retval None */ static void CDC_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Selects the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enables the display */ BSP_LCD_DisplayOn(); /* Initialize the LCD Log module */ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS CDC Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS CDC Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start CDC Interface */ USBH_UsrLog("Starting CDC Demo"); Menu_Init(); /* Initialize microSD */ if (SD_StorageInit() == 0) { SD_StorageParse(); } }
int main(void) { extern uint32_t SystemCoreClock; //HAL init, etc common_init(); //System clock config (200 MHz) SystemClock_Config(); //LCD, SDRAM, DMA2D init. lcd_init(); LCD_LOG_Init(); LCD_LOG_SetHeader( ( uint8_t* )"LCD LOG" ); LCD_UsrLog( "LOG is ready\n" ); LCD_UsrLog( "MCU runs at %lu MHz\n", SystemCoreClock / 1000000 ); LCD_UsrLog( "Define threads\n" ); //Init on BTN pressed if( BSP_PB_GetState( BUTTON_KEY ) ) { //KEY pressed LCD_UsrLog( "AF\n" ); LCD_UsrLog( "Done!\n" ); while(1) { //Do nothing } } else { //Normal mode } LCD_UsrLog( "Create threads\n" ); tasks_init(); LCD_UsrLog( "Starting OS kernel...\n" ); osKernelStart(); return 0; }
/** * @brief MTP application Init. * @param None * @retval None */ static void MTP_InitApplication(void) { /* Configure KEY Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LEDs */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialisation */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /*Selects the LCD Layer*/ BSP_LCD_SelectLayer(1); /*Enables the display*/ BSP_LCD_DisplayOn(); /*Init the LCD Log module*/ LCD_LOG_Init(); #ifdef USE_USB_HS LCD_LOG_SetHeader((uint8_t *)" USB OTG HS MTP Host"); #else LCD_LOG_SetHeader((uint8_t *)" USB OTG FS MTP Host"); #endif LCD_UsrLog("USB Host library started.\n"); /* Start MTP Interface */ USBH_UsrLog("Starting MTP Demo"); /* Init Audio interface */ AUDIO_Init(); /* Start MTP Interface */ MTP_MenuInit(); }
/** * @brief USBH_USR_Init * Displays the message on LCD for host lib initialization * @param None * @retval None */ void USBH_USR_Init(void) { static uint8_t startup = 0; if(startup == 0 ) { startup = 1; /* Configure the LEDs */ STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO); /* Initialize the LCD */ LCD_Init(); LCD_LayerInit(); /* Set LCD background layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Set LCD transparency */ LCD_SetTransparency(0); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* LTDC reload configuration */ LTDC_ReloadConfig(LTDC_IMReload); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* LCD Log initialization */ LCD_LOG_Init(); #ifdef USE_USB_OTG_HS LCD_LOG_SetHeader("PDF Create"); #else LCD_LOG_SetHeader(" USB OTG FS MSC Host"); #endif LCD_UsrLog("> USB Host library started.\n"); LCD_LOG_SetFooter (" USB Host Library v2.1.0" ); } }
/** * @brief LCD configuration. * @param None * @retval None */ static void LCD_Config(void) { /* LCD Initialization */ BSP_LCD_Init(); /* LCD Layers Initialization */ BSP_LCD_LayerDefaultInit(LCD_FOREGROUND_LAYER, (LCD_FRAME_BUFFER + BUFFER_OFFSET)); /* Configure the transparency for foreground : Increase the transparency */ BSP_LCD_SetTransparency(LCD_BACKGROUND_LAYER, 0); BSP_LCD_SelectLayer(LCD_FOREGROUND_LAYER); /* LCD Log initialization */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"LTDC Application"); LCD_UsrLog("> USB Host library started.\n"); LCD_LOG_SetFooter ((uint8_t *)" USB Host Library V3.2.0" ); }
/** * @brief LCD Log demo * @param None * @retval None */ void Log_demo(void) { uint8_t i = 0; /* Initialize LCD Log module */ LCD_LOG_Init(); /* Show Header and Footer texts */ LCD_LOG_SetHeader((uint8_t*)"This is the header"); LCD_LOG_SetFooter((uint8_t*)"This is the footer"); /* Wait For User inputs */ while(CheckForUserInput() == 0); /* Output User logs */ for (i = 0; i < 10; i++) { LCD_UsrLog ("This is Line %d \n", i); HAL_Delay(100); } HAL_Delay(1500); /* Clear Old logs */ LCD_LOG_ClearTextZone(); /* Output new user logs */ for (i = 0; i < 30; i++) { LCD_UsrLog ("This is Line %d \n", i); HAL_Delay(100); } /* Check for joystick user input for scroll (back and forward) */ while (1) { if(CheckForUserInput() > 0) { return; } HAL_Delay (10); } }
/** * @brief Audio Application Init. * @param None * @retval None */ static void AUDIO_InitApplication(void) { /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Configure Joystick in EXTI mode */ BSP_JOY_Init(JOY_MODE_EXTI); /* Configure the LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* Initialize the LCD */ BSP_LCD_Init(); /* LCD Layer Initialization */ BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS); /* Select the LCD Layer */ BSP_LCD_SelectLayer(1); /* Enable the display */ BSP_LCD_DisplayOn(); /* Init the LCD Log module */ LCD_LOG_Init(); LCD_LOG_SetHeader((uint8_t *)"Audio Playback and Record Application"); LCD_UsrLog("USB Host library started.\n"); /* Start Audio interface */ USBH_UsrLog("Starting Audio Demo"); /* Init Audio interface */ AUDIO_PLAYER_Init(); /* Start Audio interface */ AUDIO_MenuInit(); }
/** * @brief LCD Log demo * @param None * @retval None */ void Log_demo(void) { uint8_t i = 0; /* Wait For User inputs */ while(CheckForUserInput() == 0); BSP_JOY_Init(JOY_MODE_GPIO); /* Initialize LCD Log module */ LCD_LOG_Init(); /* Show Header and Footer texts */ LCD_LOG_SetHeader((uint8_t *)"Log Example"); /* Output User logs */ for (i = 0; i < 10; i++) { LCD_UsrLog ("This is Line %d \n", i); } HAL_Delay(2000); /* Clear Old logs */ LCD_LOG_ClearTextZone(); /* Output new user logs */ for (i = 0; i < 30; i++) { LCD_UsrLog ("This is Line %d \n", i); } while (1) { if(CheckForUserInput() > 0) { return; } HAL_Delay (10); } }