configs/stm32f429i-disco/src/stm32_lcd.c: Handle multiple calls to up_fbinitialize()

This commit is contained in:
Gregory Nutt
2019-03-08 13:53:59 -06:00
parent 1f22ebfac3
commit 28115504ec
2 changed files with 19 additions and 12 deletions
+18 -12
View File
@@ -39,6 +39,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <stdbool.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
@@ -528,25 +529,30 @@ int board_lcd_initialize(void)
int up_fbinitialize(int display) int up_fbinitialize(int display)
{ {
#ifdef CONFIG_STM32F429I_DISCO_ILI9341_FBIFACE static bool initialized = false;
int ret; int ret;
/* Initialize the ili9341 LCD controller */ if (!initialized)
ret = stm32_ili9341_initialize();
if (ret == OK)
{ {
#ifdef CONFIG_STM32F429I_DISCO_ILI9341_FBIFACE
/* Initialize the ili9341 LCD controller */
ret = stm32_ili9341_initialize();
if (ret >= OK)
{
ret = stm32_ltdcinitialize();
}
#else
/* Custom LCD display with RGB interface */
ret = stm32_ltdcinitialize(); ret = stm32_ltdcinitialize();
#endif
initialized = (ret >= OK);
} }
return ret; return ret;
#else
/* Custom LCD display with RGB interface */
return stm32_ltdcinitialize();
#endif
} }
/**************************************************************************** /****************************************************************************
+1
View File
@@ -73,6 +73,7 @@
int up_fbinitialize(int display) int up_fbinitialize(int display)
{ {
/* Custom LCD display with RGB interface */ /* Custom LCD display with RGB interface */
stm32_configgpio(GPIO_LCD_DISP); stm32_configgpio(GPIO_LCD_DISP);
stm32_configgpio(GPIO_LCD_BL); stm32_configgpio(GPIO_LCD_BL);