boards/arm/imxrt/imxrt1060-evk/src/imxrt_lcd.c: Add support for LCD. Clean up some LCD-related interfaces.

This commit is contained in:
Fabio Balzano 2019-10-20 10:46:21 -06:00 committed by Gregory Nutt
parent ec298554ff
commit 8bfb9a486e
8 changed files with 136 additions and 7 deletions

View File

@ -51,7 +51,6 @@
#include <nuttx/video/fb.h>
#include "up_arch.h"
#include <arch/board/board.h>
#include <nuttx/board.h>
@ -60,6 +59,8 @@
#include "hardware/imxrt_pinmux.h"
#include <arch/board/board.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -506,7 +507,7 @@ int up_fbinitialize(int display)
/* Reset the LCD */
imxrt_lcdinitialize();
imxrt_lcd_initialize();
imxrt_lcdreset();

View File

@ -44,14 +44,14 @@
* Included Files
****************************************************************************/
#include "hardware/imxrt_lcd.h"
#include <nuttx/config.h>
#include <stdbool.h>
#include <nuttx/nx/nxglib.h>
#include "hardware/imxrt_lcd.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -196,7 +196,7 @@ void imxrt_lcdclear(nxgl_mxpixel_t color);
*
****************************************************************************/
void imxrt_lcdinitialize(void);
void imxrt_lcd_initialize(void);
/****************************************************************************
* Name: IMXRT_backlight

View File

@ -59,7 +59,7 @@
*
****************************************************************************/
void imxrt_lcdinitialize(void)
void imxrt_lcd_initialize(void)
{
/* Configure the LCD backlight (and turn the backlight off) */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* boards/arm/imxrt/imxrt1060/include/board.h
* boards/arm/imxrt/imxrt1060-evk/include/board.h
*
* Copyright (C) 2018-2019 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>

View File

@ -70,4 +70,8 @@ ifeq ($(CONFIG_MMCSD_SPI),y)
CSRCS += imxrt_mmcsd_spi.c
endif
ifeq ($(CONFIG_IMXRT_LCD),y)
CSRCS += imxrt_lcd.c
endif
include $(TOPDIR)/boards/Board.mk

View File

@ -84,6 +84,14 @@
#define GPIO_LED (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GPIO_PORT1 | \
GPIO_PIN9 | IOMUX_LED)
/* Backlight of LCD */
#define IOMUX_LCD_BL (IOMUX_PULL_NONE | IOMUX_CMOS_OUTPUT | \
IOMUX_DRIVE_40OHM | IOMUX_SPEED_MEDIUM | \
IOMUX_SLEW_SLOW)
#define GPIO_LCD_BL (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GPIO_PORT2 | \
GPIO_PIN31 | IOMUX_LCD_BL)
/* Buttons
*
* The IMXRT board has one external user button
@ -210,5 +218,18 @@ int imxrt_mmcsd_spi_initialize(int minor)
void imxrt_autoled_initialize(void);
#endif
#ifdef CONFIG_DEV_GPIO
/****************************************************************************
* Name: imxrt_gpio_initialize
*
* Description:
* Initialize GPIO drivers for use with /apps/examples/gpio
*
****************************************************************************/
int imxrt_gpio_initialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_IMXRT1060_EVK_SRC_IMXRT1060_EVK_H */

View File

@ -46,6 +46,7 @@
#include <syslog.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/video/fb.h>
#include <imxrt_lpi2c.h>
#include <imxrt_lpspi.h>
@ -180,6 +181,25 @@ int imxrt_bringup(void)
}
#endif
#ifdef CONFIG_DEV_GPIO
ret = imxrt_gpio_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_VIDEO_FB
/* Initialize and register the framebuffer driver */
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK;
}

View File

@ -0,0 +1,83 @@
/****************************************************************************
* boards/arm/imxrt/imxrt1060-evk/src/imxrt_lcd.c
*
* Copyright (C) 2019 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 "imxrt_lcd.h"
#include "imxrt_gpio.h"
#include "imxrt1060-evk.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: imxrt_lcd_initialize
*
* Description:
* Initialize the LCD. Setup backlight (initially off)
*
****************************************************************************/
void imxrt_lcd_initialize(void)
{
/* Configure the LCD backlight (and turn the backlight off) */
imxrt_config_gpio(GPIO_LCD_BL);
}
/****************************************************************************
* Name: imxrt_backlight
*
* Description:
* If CONFIG_IMXRT_LCD_BACKLIGHT is defined, then the board-specific
* logic must provide this interface to turn the backlight on and off.
*
****************************************************************************/
#ifdef CONFIG_IMXRT_LCD_BACKLIGHT
void imxrt_backlight(bool blon)
{
imxrt_gpio_write(GPIO_LCD_BL, blon); /* High illuminates */
}
#endif