/** * @brief LCD configuration. * @param None * @retval None */ static void LCD_Config(void) { /* LCD Initialization */ /* Two layers are used in this application simultaneously so "LCD_MIN_PCLK" is recommended to programme the PCLK at 20 MHz */ BSP_LCD_InitEx(LCD_MIN_PCLK); /* 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); }
// 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 Initializes the LCD. * @param None * @retval LCD state */ uint8_t BSP_LCD_Init(void) { return (BSP_LCD_InitEx(LCD_MAX_PCLK)); }
/** * @brief Main program * @param None * @retval None */ int main(void) { uint8_t sdram_status = SDRAM_OK; uint8_t lcd_status = LCD_OK; uint32_t ts_status = TS_OK; p_bmp_converted_pixel_data = (uint8_t *)CONVERTED_FRAME_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(); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- Initialize the SDRAM */ sdram_status = BSP_SDRAM_Init(); if(sdram_status != SDRAM_OK) { Error_Handler(); } /*##-2- LCD Initialization #################################################*/ /* Initialize the LCD DSI */ lcd_status = BSP_LCD_Init() ; if(lcd_status != LCD_OK) { Error_Handler(); } lcd_status = BSP_LCD_InitEx(LCD_ORIENTATION_LANDSCAPE); if(lcd_status != LCD_OK) { Error_Handler(); } BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER_BACKGROUND, LCD_FB_START_ADDRESS); /* Clear the LCD Background layer */ BSP_LCD_Clear(LCD_COLOR_WHITE); /*##-3- Touch screen initialization ########################################*/ BSP_TS_ResetTouchData(&TS_State); /* If calibration is not yet done, proceed with calibration */ if (TouchScreen_IsCalibrationDone() == 0) { ts_status = Touchscreen_Calibration(); if(ts_status == TS_OK) { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 65, (uint8_t *)"Touchscreen calibration success.", CENTER_MODE); } } /* of if (TouchScreen_IsCalibrationDone() == 0) */ /*##-4- Link the SD Card disk I/O driver ###################################*/ /* Clear the LCD and display waiting message */ BSP_LCD_Clear(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 - 27, (uint8_t*)"Please WAIT few seconds", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 - 12, (uint8_t*)"Creating FAT file system on SD card", CENTER_MODE); if(FATFS_LinkDriver(&SD_Driver, SDPath) != 0) { /* FatFs Initialization Error */ BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 3, (uint8_t*)"FAT FS Error !!", CENTER_MODE); Error_Handler(); } /*##-4- Register the file system object to the FatFs module ################*/ if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) != FR_OK) { /* FatFs Initialization Error */ BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 3, (uint8_t*)"FAT FS Error !!", CENTER_MODE); Error_Handler(); } /* Create a FAT file system (format) on the logical drive */ if(f_mkfs((TCHAR const*)SDPath, 0, 0) != FR_OK) { BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 3, (uint8_t*)"FAT FS Error !!", CENTER_MODE); 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) { /* 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(); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- Initialize the LCD #################################################*/ /* Two layers are used in this application simultaneously so "LCD_MIN_PCLK" is recommended to programme the PCLK at 20 MHz */ BSP_LCD_InitEx(LCD_MIN_PCLK); /* 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); BSP_LCD_SetLayerWindow(0, 0, 0, 480, 272); /*##-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); /*##-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; } } }
uint8_t LCD_DISCO_F469NI::InitEx(LCD_OrientationTypeDef orientation) { return BSP_LCD_InitEx(orientation); }