/** * @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 LCD configuration * @param None * @retval None */ static void LCD_Config(void) { /* LCD Initialization */ /* Two layers are used in this application but not simultaneously so "LCD_MAX_PCLK" is recommended to programme the maximum PCLK = 25,16 MHz */ BSP_LCD_Init(); /* LCD Initialization */ BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS+(BSP_LCD_GetXSize()*BSP_LCD_GetYSize()*4)); /* Enable the LCD */ BSP_LCD_DisplayOn(); /* Select the LCD Background Layer */ BSP_LCD_SelectLayer(0); /* Clear the Background Layer */ BSP_LCD_Clear(LCD_COLOR_BLACK); /* Select the LCD Foreground Layer */ BSP_LCD_SelectLayer(1); /* Clear the Foreground Layer */ BSP_LCD_Clear(LCD_COLOR_BLACK); /* Configure the transparency for foreground and background : Increase the transparency */ BSP_LCD_SetTransparency(0, 0); BSP_LCD_SetTransparency(1, 100); }
/** * @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(); }
/*------------------------------------------------------- 功能 : 初始化 输入 : void 返回 : void Copyright : yitiandelan. ---------------------------------------------------------*/ void BSP_Init(void) { BSP_OSC_Init(); #if (configUSE_LED == 1) BSP_LED_Init(); #endif #if (configUSE_DAC == 1) BSP_DAC_Init(); #endif #if (configUSE_ADC123 == 1) BSP_ADC_Init(); #endif #if (configUSE_ExternADC == 1) BSP_ADC_ex_Init(); #endif #if (configUSE_LCD == 1) BSP_LCD_Init(); #endif #if (configUSE_CODEC == 1) BSP_CODEC_Init(); #endif #if (configUSE_PWM == 1) BSP_TIM3_Init(); #endif #if (configUSE_RTT == 1) BSP_RTT_Init(); #endif #if (configUSE_USB == 1) BSP_USB_Init(); #endif #if (configUSE_MPU == 1) BSP_MPU_Init(); #endif }
/** * @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 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 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 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 Display Init (LCD) * @param None * @retval None */ static void Display_Init(void) { /* Initialize the LCD */ BSP_LCD_Init(); /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set LCD Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(0, 0, (uint8_t*)MESSAGE1, CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 30, (uint8_t*)"ADC Low Power Mode", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 45, (uint8_t*)"Press Tamper push-button", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 60, (uint8_t*)MESSAGE3, CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(10, 90, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize()- 100); BSP_LCD_DrawRect(11, 91, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize()- 102); BSP_LCD_SetFont(&Font24); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); }
/** * @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 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 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 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 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 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(); /*##-1- Initialize the SRAM ################################################*/ BSP_SRAM_Init(); /*##-2- Initialize the LCD #################################################*/ BSP_LCD_Init(); /*##-3- Camera Initialization and start capture ############################*/ /* Initialize the Camera */ BSP_CAMERA_Init(CAMERA_R320x240); /* Start the Camera Capture */ BSP_CAMERA_ContinuousStart((uint8_t *)CAMERA_FRAME_BUFFER); /* Infinite loop */ while (1) { } }
/** * @brief LCD configuration. * @param None * @retval None */ static void LCD_Config(void) { /* LCD Initialization */ BSP_LCD_Init(); /* LCD Layers Initialization */ BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS); BSP_LCD_LayerDefaultInit(1, (LCD_FB_START_ADDRESS+(BSP_LCD_GetXSize()*BSP_LCD_GetYSize()*4))); /* Enable the LCD */ BSP_LCD_DisplayOn(); /* Set LCD Background Layer */ BSP_LCD_SelectLayer(0); /* Clear the Background Layer */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set LCD Foreground Layer */ BSP_LCD_SelectLayer(1); /* Clear the Foreground Layer */ BSP_LCD_Clear(LCD_COLOR_BLACK); /* Configure and enable the Color Keying feature */ BSP_LCD_SetColorKeying(1, 0); /* Configure the transparency for foreground: Increase the transparency */ BSP_LCD_SetTransparency(1, 100); }
/** * @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 LCD configuration * @param None * @retval None */ static void LCD_Config(void) { uint8_t lcd_status = LCD_OK; /* LCD DSI initialization in mode Video Burst */ /* 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_LayerDefaultInit(1, LCD_BG_LAYER_ADDRESS); /* Select the LCD Background Layer */ BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_BACKGROUND); /* Clear the Background Layer */ BSP_LCD_Clear(LCD_COLOR_BLACK); /* Select the LCD Foreground Layer */ BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER_FOREGROUND); /* Clear the Foreground Layer */ BSP_LCD_Clear(LCD_COLOR_BLACK); /* Configure the transparency for foreground and background : Increase the transparency */ BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_BACKGROUND, 0); BSP_LCD_SetTransparency(LTDC_ACTIVE_LAYER_FOREGROUND, 100); }
void lcd_init(void) { BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(0, (uint32_t)LCD_FRAME_BUFFER); BSP_LCD_SelectLayer(0); BSP_LCD_Clear(LCD_COLOR_RED); BSP_LCD_SetBackColor(LCD_COLOR_RED); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); // BSP_LCD_LayerDefaultInit(1, (uint32_t)LCD_FRAME_BUFFER + 76800); // BSP_LCD_SelectLayer(1); // BSP_LCD_Clear(LCD_COLOR_RED); // BSP_LCD_SetBackColor(LCD_COLOR_RED); // BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetLayerVisible(0, ENABLE); // BSP_LCD_SetLayerVisible(1, ENABLE); BSP_LCD_DisplayOn(); for (int i = 0; i < LCD_SIZE; i ++) { lcd.screen[i] = ' '; } lcd.col = 0; }
/** * @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 Main program * @param None * @retval None */ int main(void) { /* This sample code shows how to use STM32F4xx GPIO HAL API to toggle PG13 IOs (connected to LED3 on STM32F429i-Discovery board) in an infinite loop. To proceed, 3 steps are required: */ /* 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(); /* -1- Initialize LEDs mounted on Discovery board */ BSP_LED_Init(LED3); BSP_LED_Init(LED4); /* -2- Configure the system clock */ SystemClock_Config(); /* -3- Configure EXTI Line0 (connected to PA0 pin) in interrupt mode */ EXTILine0_Config(); /*##-1- Initialize the LCD #################################################*/ /* Initialize the LCD */ BSP_LCD_Init(); /* Initialise the LCD Layers */ BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER); /* Gleich bleibende Einstellenungen am LCD-Display */ /* Set LCD Foreground Layer */ BSP_LCD_SelectLayer(1); BSP_LCD_SetFont(&LCD_DEFAULT_FONT); /* Clear the LCD */ BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_DARKBLUE); /* Display LCD messages */ BSP_LCD_DisplayStringAt(0, 10, (uint8_t*)"GOLF CART", CENTER_MODE); BSP_LCD_SetFont(&Font16); BSP_LCD_DisplayStringAt(0, 35, (uint8_t*)"v in km/h", CENTER_MODE); /* Infinite loop */ while (1) { if (uAenderung) { GeschwindigkeitAufLCD(uAktuelleGeschwindigkeit_zehntelkmh); uAenderung = 0; } } }
/** * @brief Main program * @param None * @retval None */ int main(void) { HAL_StatusTypeDef hal_status = HAL_OK; uint8_t lcd_status = LCD_OK; /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization: global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Wait until MFX is ready after reset */ HAL_Delay(100); /* Configure LED1, LED2 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); /*##-1- Initialize the SDRAM ##############################################*/ BSP_SDRAM_Init(); /*##-2- Initialize the LCD #################################################*/ /* Proceed to LTDC, DSI initialization and LCD screen initialization * with the configuration filled in above */ lcd_status = BSP_LCD_Init(); LCD_LayerDefaultInit(1, (uint32_t)&aBufferResult); BSP_LCD_SelectLayer(1); OnError_Handler(lcd_status != LCD_OK); HAL_Delay(100); /*##-3- DMA2D configuration ################################################*/ DMA2D_Config(); /*##-4- Start DMA2D transfer ###############################################*/ hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle, (uint32_t)LCD_COLOR_GREEN, /* Fill the DMA2D output register with this color */ (uint32_t)&aBufferResult, /* DMA2D output register */ LAYER_SIZE_X, LAYER_SIZE_Y); OnError_Handler(hal_status != HAL_OK); while (1) { ; } }
// Constructor LCD_DISCO_F469NI::LCD_DISCO_F469NI() { BSP_LCD_Init(); BSP_LCD_InitEx(LCD_ORIENTATION_LANDSCAPE); BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER_BACKGROUND, LCD_FB_START_ADDRESS); BSP_LCD_SetFont(&Font20); BSP_LCD_Clear(LCD_COLOR_WHITE); }
/** * @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 Main program * @param None * @retval None */ int main(void) { uint32_t i; uint32_t *ptrLcd; /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Configure the system clock to 200 MHz */ SystemClock_Config(); /*##-1- Initialise the LCD #################################################*/ BSP_LCD_Init(); /* Init LCD screen buffer */ ptrLcd = (uint32_t*)(LCD_FRAME_BUFFER); for (i=0; i<(BSP_LCD_GetXSize()*BSP_LCD_GetYSize()); i++) { ptrLcd[i]=0; } BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER); /* Enable the LCD */ BSP_LCD_DisplayOn(); /* Select the LCD Foreground layer */ BSP_LCD_SelectLayer(1); /* Set active window */ BSP_LCD_SetLayerWindow(1, xoffset, yoffset, xsize, ysize); /*##-2- Camera Initialisation and start capture ############################*/ /* Initialize the Camera */ BSP_CAMERA_Init(resolution); /* Wait 1s before Camera snapshot */ HAL_Delay(1000); /* Start the Camera Capture */ BSP_CAMERA_SnapshotStart((uint8_t *)CAMERA_FRAME_BUFFER); 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 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(); /* Enable the LCD */ BSP_LCD_DisplayOn(); /* Clear the LCD Background layer */ BSP_LCD_Clear(LCD_COLOR_WHITE); /*##-2- Touch screen initialization ########################################*/ Touchscreen_Calibration(); BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); /*##-3- Link the SD Card disk I/O driver ###################################*/ if(FATFS_LinkDriver(&SD_Driver, SDPath) != 0) { /* FatFs Initialization Error */ Error_Handler(); } /* Create a FAT file system (format) on the logical drive */ f_mkfs((TCHAR const*)SDPath, 0, 0); /*##-4- Register the file system object to the FatFs module ################*/ if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) != FR_OK) { /* FatFs Initialization Error */ Error_Handler(); } /*##-5- Draw the menu ######################################################*/ Draw_Menu(); /* Infinite loop */ while (1) { /*##-6- Configure the touch screen and Get the position ####################*/ GetPosition(); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { HAL_StatusTypeDef hal_status = HAL_OK; uint8_t lcd_status = LCD_OK; /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization: global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Wait until MFX is ready after reset */ HAL_Delay(100); /* Configure LED1, LED2 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); BSP_LED_Init(LED3); /*##-1- Initialize the LCD #################################################*/ /* Proceed to LTDC, DSI initialization and LCD screen initialization * with the configuration filled in above */ lcd_status = BSP_LCD_Init(); LCD_LayerDefaultInit(0, (uint32_t)&ARGB8888_300x120); //Background layer shows original image, on top of the screen LCD_LayerDefaultInit(1, (uint32_t)&aBufferResult); //Forground layer shows converted image, on bottom of the screen BSP_LCD_SelectLayer(1); OnError_Handler(lcd_status != LCD_OK); HAL_Delay(100); /*##-2- DMA2D configuration ################################################*/ DMA2D_Config(); /*##-3- Start DMA2D transfer ###############################################*/ hal_status = HAL_DMA2D_Start_IT(&Dma2dHandle, (uint32_t)&ARGB8888_300x120, /* Input image 300x120 of format ARGB8888 (32 bpp) */ (uint32_t)&aBufferResult, /* Output image of same size 300x120 after conversion by PFC in ARGB4444 (16 bpp) */ LAYER_SIZE_X, LAYER_SIZE_Y); OnError_Handler(hal_status != HAL_OK); while (1) { ; } }
int main(void) { HAL_Init(); /* Configure the system clock */ SystemClock_Config(); BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(1, (uint32_t) LCD_FRAME_BUFFER); BSP_LCD_SetLayerVisible(1, ENABLE); BSP_LCD_SelectLayer(1); BSP_LCD_Clear(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_DisplayOn(); BSP_LCD_DisplayStringAtLine(0, (uint8_t *) "Hello FreeRTOS"); #define LED_TASK_PRIORITY ((1 + tskIDLE_PRIORITY) | portPRIVILEGE_BIT) #define LCD_TASK_PRIORITY ((1 + tskIDLE_PRIORITY) | portPRIVILEGE_BIT) #define LED_TASK_PRIORITY_LOW ((1 + tskIDLE_PRIORITY) | portPRIVILEGE_BIT) #define LED_TASK_PRIORITY_HIGH ((2 + tskIDLE_PRIORITY) | portPRIVILEGE_BIT) //xTaskCreate( (pdTASK_CODE)test_task_delay, "test", configMINIMAL_STACK_SIZE, 0, LED_TASK_PRIORITY, NULL); //xTaskCreate( (pdTASK_CODE)test_task_delay_until, "test", configMINIMAL_STACK_SIZE, 0, LED_TASK_PRIORITY, NULL); /*std::stringstream output; std::string outputstring; const char * chararray; output.str(std::string()); output << "Counter: " << 0; outputstring = ""; outputstring = output.str(); chararray = ""; chararray = outputstring.c_str(); BSP_LCD_DisplayStringAtLine (1, (uint8_t *) chararray);*/ //xTaskCreate( (pdTASK_CODE)led1_task, "led1", 256, 0, LED_TASK_PRIORITY, NULL); //xTaskCreate( (pdTASK_CODE)led2_task, "led2", 256, 0, LED_TASK_PRIORITY, NULL); //xTaskCreate( (pdTASK_CODE)lcd_task, "lcd", 256, 0, LCD_TASK_PRIORITY, NULL); xTaskCreate( (pdTASK_CODE)led1_task_timeslicing, "led1", 256, 0, LED_TASK_PRIORITY, NULL); xTaskCreate( (pdTASK_CODE)led2_task_timeslicing, "led2", 256, 0, LED_TASK_PRIORITY+1, NULL); // was LED_TASK_PRIORITY //job_descriptor blink1_job_descriptor = job_descriptor(1000/3, LED3); //xTaskCreate( (pdTASK_CODE)blink1_task, "led3", 256, &blink1_job_descriptor, LED_TASK_PRIORITY, NULL); //job_descriptor blink2_job_descriptor = job_descriptor(2000/3, LED4); //xTaskCreate( (pdTASK_CODE)blink2_task, "led4", 256, &blink2_job_descriptor, LED_TASK_PRIORITY, NULL); //xTaskCreate( (pdTASK_CODE)blink_task_low_priority, "led3", 256, 0, LED_TASK_PRIORITY_LOW, NULL); //xTaskCreate( (pdTASK_CODE)blink_task_high_priority, "led4", 256, 0, LED_TASK_PRIORITY_HIGH, NULL); vTaskStartScheduler (); return 0; }
/** * @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 Main program * @param None * @retval None */ int main(void) { uint8_t lcd_status = LCD_OK; /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Set NVIC Group Priority to 4 - Low Level Initialization: global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Initialize the LCD */ lcd_status = BSP_LCD_Init(); OnError_Handler(lcd_status != LCD_OK); BSP_LCD_LayerDefaultInit(0, LAYER0_ADDRESS); BSP_LCD_SelectLayer(0); /* Set LTDC Line Event */ HAL_LTDC_ProgramLineEvent(&hltdc_eval, 0); /* Display example brief */ LCD_BriefDisplay(); /* Copy Buffer 0 into buffer 1, so only image area to be redrawn later */ CopyBuffer((uint32_t *)Buffers[0], (uint32_t *)Buffers[1], 0, 0, 800, 480); /* Infinite loop */ while (1) { if(pend_buffer < 0) { /* Prepare back buffer */ CopyBuffer((uint32_t *)Images[ImageIndex++], (uint32_t *)Buffers[1- front_buffer], 240, 160, 320, 240); pend_buffer = 1- front_buffer; if(ImageIndex >= 2) { ImageIndex = 0; } /* Wait some time before switching to next stage */ HAL_Delay(2000); } } }