In LPC1788 24-bit color mode, we need to tell NX that the resolution if 32 bpp; Add interfaces to control Open1788 backlight

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5798 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-03-28 17:12:11 +00:00
parent 2fa0f9f32e
commit c56a7d2110
5 changed files with 123 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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 */

View File

@ -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 */