summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/arch/Kconfig3
-rw-r--r--nuttx/arch/arm/src/lpc17xx/Kconfig13
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c37
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h20
-rw-r--r--nuttx/configs/open1788/nxlines/defconfig7
-rw-r--r--nuttx/configs/open1788/src/Makefile4
-rw-r--r--nuttx/configs/open1788/src/lpc17_boardinitialize.c15
-rw-r--r--nuttx/configs/open1788/src/lpc17_lcd.c96
-rw-r--r--nuttx/configs/open1788/src/open1788.h21
-rw-r--r--nuttx/graphics/README.txt2
10 files changed, 190 insertions, 28 deletions
diff --git a/nuttx/arch/Kconfig b/nuttx/arch/Kconfig
index 55f81aa69..01e3809ce 100644
--- a/nuttx/arch/Kconfig
+++ b/nuttx/arch/Kconfig
@@ -103,7 +103,7 @@ source arch/x86/Kconfig
source arch/z16/Kconfig
source arch/z80/Kconfig
-comment "External Memory Configuration"
+menu "External Memory Configuration"
config ARCH_HAVE_EXTNAND
bool
@@ -243,6 +243,7 @@ config ARCH_EXTSRAM1HEAP
Add external SRAM Bank 1 into the heap.
endif
+endmenu
comment "Architecture Options"
diff --git a/nuttx/arch/arm/src/lpc17xx/Kconfig b/nuttx/arch/arm/src/lpc17xx/Kconfig
index 7f7da0be6..cad80ac7e 100644
--- a/nuttx/arch/arm/src/lpc17xx/Kconfig
+++ b/nuttx/arch/arm/src/lpc17xx/Kconfig
@@ -639,6 +639,19 @@ config LPC17_LCD_REFRESH_FREQ
---help---
LCD refesh rate (Hz)
+config LPC17_LCD_BACKLIGHT
+ bool "Enable backlight"
+ default y
+ ---help---
+ Enable backlight support. If LPC17_LCD_BACKLIGHT is selected, then
+ the board-specific logic must provide this lpc17_backlight()
+ interface so that the LCD driver can turn the backlight on and off
+ as necessary. You should select this option and implement
+ lpc17_backlight() if your board provides GPIO control over the
+ backlight. This interface provides only ON/OFF control of the
+ backlight. If you want finer control over the backlight level (for
+ example, using PWM), then this interface would need to be extended.
+
config LPC17_LCD_TFTPANEL
bool "TFT Panel"
default y
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
index f1d2ea501..b4086ce0b 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
@@ -523,9 +523,7 @@ int up_fbinitialize(void)
/* Turn on LCD clock */
- regval = getreg32(LPC17_SYSCON_PCONP);
- regval |= SYSCON_PCONP_PCLCD;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ modifyreg32(LPC17_SYSCON_PCONP, 0, SYSCON_PCONP_PCLCD);
/* Disable the cursor */
@@ -699,6 +697,11 @@ int up_fbinitialize(void)
regval |= LCD_CTRL_LCDPWR;
putreg32(regval, LPC17_LCD_CTRL);
+#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+ /* Turn on the back light */
+
+ lpc17_backlight(true);
+#endif
return OK;
}
@@ -740,7 +743,33 @@ FAR struct fb_vtable_s *up_fbgetvplane(int vplane)
void fb_uninitialize(void)
{
- gdbg("Not implemented!\n");
+ uint32_t regval;
+ int i;
+
+ /* We assume there is only one use of the LCD and so we do not need to
+ * worry about mutually exclusive access to the LCD hardware.
+ */
+
+#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+ /* Turn off the back light */
+
+ lpc17_backlight(false);
+#endif
+
+ /* Disable the LCD controller */
+
+ regval = getreg32(LPC17_LCD_CTRL);
+ regval &= ~LCD_CTRL_LCDPWR;
+ putreg32(regval, LPC17_LCD_CTRL);
+
+ for (i = LPC17_LCD_PWRDIS_DELAY; i; i--);
+
+ regval &= ~LCD_CTRL_LCDEN;
+ putreg32(regval, LPC17_LCD_CTRL);
+
+ /* Turn off clocking to the LCD. modifyreg32() can do this atomically. */
+
+ modifyreg32(LPC17_SYSCON_PCONP, SYSCON_PCONP_PCLCD, 0);
return OK;
}
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h
index 1545a7a56..2b560bb47 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.h
@@ -41,6 +41,9 @@
************************************************************************************/
#include <nuttx/config.h>
+
+#include <stdbool.h>
+
#include <nuttx/nx/nxglib.h>
#include "chip/lpc17_lcd.h"
@@ -81,7 +84,7 @@
# define LPC17_BPP 16
# define LPC17_COLOR_FMT FB_FMT_Y16
#elif defined(CONFIG_LPC17_LCD_BPP24)
-# define LPC17_BPP 24
+# define LPC17_BPP 32 /* Only 24 of 32 bits used for RGB */
# define LPC17_COLOR_FMT FB_FMT_RGB24
# ifndef CONFIG_LPC17_LCD_TFTPANEL
# error "24 BPP is only available for a TFT panel"
@@ -164,7 +167,7 @@
*/
/************************************************************************************
- * Name: lpc17_lcdclear
+ * Name: lpc17_lcdclear
*
* Description:
* This is a non-standard LCD interface just for the LPC17xx. Clearing the display
@@ -176,4 +179,17 @@
void lpc17_lcdclear(nxgl_mxpixel_t color);
+/************************************************************************************
+ * Name: lpc17_backlight
+ *
+ * Description:
+ * If CONFIG_LPC17_LCD_BACKLIGHT is defined, then the board-specific logic must
+ * provide this interface to turn the backlight on and off.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+void lpc17_backlight(bool blon);
+#endif
+
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_LCD_H */
diff --git a/nuttx/configs/open1788/nxlines/defconfig b/nuttx/configs/open1788/nxlines/defconfig
index 45d19507b..7c4eccb1f 100644
--- a/nuttx/configs/open1788/nxlines/defconfig
+++ b/nuttx/configs/open1788/nxlines/defconfig
@@ -182,6 +182,7 @@ CONFIG_SDIO_DMAPRIO=0x0
#
CONFIG_LPC17_LCD_VRAMBASE=0xa0010000
CONFIG_LPC17_LCD_REFRESH_FREQ=50
+CONFIG_LPC17_LCD_BACKLIGHT=y
CONFIG_LPC17_LCD_TFTPANEL=y
# CONFIG_LPC17_LCD_BPP1 is not set
# CONFIG_LPC17_LCD_BPP2 is not set
@@ -444,8 +445,8 @@ CONFIG_NX_DISABLE_2BPP=y
CONFIG_NX_DISABLE_4BPP=y
CONFIG_NX_DISABLE_8BPP=y
CONFIG_NX_DISABLE_16BPP=y
-# CONFIG_NX_DISABLE_24BPP is not set
-CONFIG_NX_DISABLE_32BPP=y
+CONFIG_NX_DISABLE_24BPP=y
+# CONFIG_NX_DISABLE_32BPP is not set
CONFIG_NX_PACKEDMSFIRST=y
#
@@ -602,7 +603,7 @@ CONFIG_EXAMPLES_NXLINES_LINECOLOR=0x00ffff00
CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=16
CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0x00ffff00
CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0x00f5f5dc
-CONFIG_EXAMPLES_NXLINES_BPP=24
+CONFIG_EXAMPLES_NXLINES_BPP=32
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT is not set
# CONFIG_EXAMPLES_NXTEXT is not set
# CONFIG_EXAMPLES_OSTEST is not set
diff --git a/nuttx/configs/open1788/src/Makefile b/nuttx/configs/open1788/src/Makefile
index 548a5792a..af8272263 100644
--- a/nuttx/configs/open1788/src/Makefile
+++ b/nuttx/configs/open1788/src/Makefile
@@ -52,6 +52,10 @@ ifeq ($(CONFIG_ARCH_EXTDRAM),y)
CSRCS += lpc17_sdraminitialize.c
endif
+ifeq ($(CONFIG_LPC17_LCD),y)
+ CSRCS += lpc17_lcd.c
+endif
+
ifeq ($(CONFIG_NSH_LIBRARY),y)
CSRCS += lpc17_nsh.c
endif
diff --git a/nuttx/configs/open1788/src/lpc17_boardinitialize.c b/nuttx/configs/open1788/src/lpc17_boardinitialize.c
index f8916f0da..896c38cf6 100644
--- a/nuttx/configs/open1788/src/lpc17_boardinitialize.c
+++ b/nuttx/configs/open1788/src/lpc17_boardinitialize.c
@@ -48,7 +48,6 @@
#include "up_internal.h"
#include "lpc17_emc.h"
-#include "lpc17_gpio.h"
#include "open1788.h"
@@ -108,12 +107,10 @@ void lpc17_boardinitialize(void)
up_ledinit();
#endif
- /* Enable the LCD backlight (unless we can defer this to a later
- * initialization phase.
- */
+ /* Configure the LCD GPIOs if LCD support has been selected. */
-#if defined(CONFIG_LPC17_LCD) && !defined(CONFIG_BOARD_INITIALIZE)
- lpc17_configgpio(GPIO_LCD_BL);
+#ifdef CONFIG_LPC17_LCD
+ lpc17_lcdinitialize();
#endif
}
@@ -133,12 +130,6 @@ void lpc17_boardinitialize(void)
#ifdef CONFIG_BOARD_INITIALIZE
void board_initialize(void)
{
- /* Enable the LCD backlight */
-
-#ifdef CONFIG_LPC17_LCD
- lpc17_configgpio(GPIO_LCD_BL);
-#endif
-
/* Perform NSH initialization here instead of from the NSH. This
* alternative NSH initialization is necessary when NSH is ran in user-space
* but the initialization function must run in kernel space.
diff --git a/nuttx/configs/open1788/src/lpc17_lcd.c b/nuttx/configs/open1788/src/lpc17_lcd.c
new file mode 100644
index 000000000..7c70e2ebd
--- /dev/null
+++ b/nuttx/configs/open1788/src/lpc17_lcd.c
@@ -0,0 +1,96 @@
+/************************************************************************************
+ * configs/open1788/src/lpc17_lcd.c
+ * arch/arm/src/board/lpc17_lcd.c
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include "lpc17_lcd.h"
+#include "lpc17_gpio.h"
+
+#include "open1788.h"
+
+#ifdef CONFIG_LPC17_LCD
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD. Setup backlight (initially off)
+ *
+ ************************************************************************************/
+
+void lpc17_lcdinitialize(void)
+{
+ /* Configure the LCD backlight (and turn the backlight off) */
+
+ lpc17_configgpio(GPIO_LCD_BL);
+}
+
+/************************************************************************************
+ * Name: lpc17_backlight
+ *
+ * Description:
+ * If CONFIG_LPC17_LCD_BACKLIGHT is defined, then the board-specific logic must
+ * provide this interface to turn the backlight on and off.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+void lpc17_backlight(bool blon)
+{
+ lpc17_gpiowrite(GPIO_LCD_BL, blon);
+}
+#endif
+
+#endif /* CONFIG_LPC17_LCD */
diff --git a/nuttx/configs/open1788/src/open1788.h b/nuttx/configs/open1788/src/open1788.h
index f0362e855..b1349eae4 100644
--- a/nuttx/configs/open1788/src/open1788.h
+++ b/nuttx/configs/open1788/src/open1788.h
@@ -112,9 +112,9 @@
#define GPIO_SD_CD (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13)
/* LCD ******************************************************************************/
-/* Backlight enable, P2[1]. Initial state is ON */
+/* Backlight enable, P2[1]. Initial state is OFF (zero) */
-#define GPIO_LCD_BL (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN1)
+#define GPIO_LCD_BL (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN1)
/************************************************************************************
* Public Types
@@ -178,7 +178,19 @@ void lpc17_nand_initialize(void);
#endif
#endif /* CONFIG_LPC17_EMC */
-/****************************************************************************
+/************************************************************************************
+ * Name: lpc17_lcdinitialize
+ *
+ * Description:
+ * Initialize the LCD. Setup backlight (initially off)
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_LPC17_LCD
+void lpc17_lcdinitialize(void);
+#endif
+
+/************************************************************************************
* Name: nsh_archinitialize
*
* Description:
@@ -191,7 +203,7 @@ void lpc17_nand_initialize(void);
* CONFIG_NSH_ARCHINIT=n:
* Called from board_initialize().
*
- ****************************************************************************/
+ ************************************************************************************/
#ifdef CONFIG_NSH_LIBRARY
int nsh_archinitialize(void);
@@ -199,4 +211,3 @@ int nsh_archinitialize(void);
#endif /* __ASSEMBLY__ */
#endif /* _CONFIGS_OPEN1788_SRC_OPEN1788_H */
-
diff --git a/nuttx/graphics/README.txt b/nuttx/graphics/README.txt
index 18aebadbd..474b0f3a9 100644
--- a/nuttx/graphics/README.txt
+++ b/nuttx/graphics/README.txt
@@ -363,7 +363,7 @@ CONFIG_NXCONSOLE_CACHESIZE
a lot of data or scrolling), then increasing the value of CONFIG_NXCONSOLE_CACHESIZE
is something that you should try. Alternatively, you can reduce the size of
CONFIG_MQ_MAXMSGSIZE which will force NxConsole task to pace the server task.
- CONFIG_NXCONSOLE_CACHESIZE should be larger than ONFIG_MQ_MAXMSGSIZE in any event.
+ CONFIG_NXCONSOLE_CACHESIZE should be larger than CONFIG_MQ_MAXMSGSIZE in any event.
CONFIG_NXCONSOLE_LINESEPARATION
This the space (in rows) between each row of test. Default: 0
CONFIG_NXCONSOLE_NOWRAP