Change the way that BPP is configured for the LPC17xx LCD so that all possible BPP options can be selected
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5790 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
8fb673e7ee
commit
2215873d8a
@ -644,11 +644,47 @@ config LPC17_LCD_REFRESH_FREQ
|
||||
---help---
|
||||
LCD refesh rate (Hz)
|
||||
|
||||
config LPC17_LCD_BPP
|
||||
int "Bits per pixel"
|
||||
default 24
|
||||
config LPC17_LCD_TFTPANEL
|
||||
bool "TFT Panel"
|
||||
default y
|
||||
---help---
|
||||
Bits per pixel
|
||||
TFT Panel vs. STN display. STN display panels require algorithmic
|
||||
pixel pattern generation to provide pseudo gray scaling on
|
||||
monochrome displays, or color creation on color displays. TFT
|
||||
display panels require the digital color value of each pixel to be
|
||||
applied to the display data inputs.
|
||||
|
||||
choice
|
||||
prompt "Bits per pixel"
|
||||
default LPC17_LCD_BPP24 if LPC17_LCD_TFTPANEL
|
||||
default LPC17_LCD_BPP16_565 if !LPC17_LCD_TFTPANEL
|
||||
|
||||
config LPC17_LCD_BPP1
|
||||
bool "1 bit per pixel"
|
||||
|
||||
config LPC17_LCD_BPP2
|
||||
bool "2 bit per pixel"
|
||||
|
||||
config LPC17_LCD_BPP4
|
||||
bool "4 bit per pixel"
|
||||
|
||||
config LPC17_LCD_BPP8
|
||||
bool "8 bit per pixel"
|
||||
|
||||
config LPC17_LCD_BPP16
|
||||
bool "16 bit per pixel"
|
||||
|
||||
config LPC17_LCD_BPP24
|
||||
bool "24 bit per pixel"
|
||||
depends on LPC17_LCD_TFTPANEL
|
||||
|
||||
config LPC17_LCD_BPP16_565
|
||||
bool "16 bpp, 5:6:5 mode"
|
||||
|
||||
config LPC17_LCD_BPP12_444
|
||||
bool "12 bpp, 4:4:4 mode"
|
||||
|
||||
endchoice
|
||||
|
||||
config LPC17_LCD_BACKCOLOR
|
||||
hex "Initial background color"
|
||||
|
@ -62,15 +62,25 @@
|
||||
|
||||
/* Framebuffer characteristics in bytes */
|
||||
|
||||
#if CONFIG_LPC17_LCD_BPP == 16
|
||||
# define FB_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * sizeof(uint16_t) + 7) / 8)
|
||||
#elif CONFIG_LPC17_LCD_BPP == 24
|
||||
# define FB_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * sizeof(uint32_t) + 7) / 8)
|
||||
#else
|
||||
# error "Unsupported BPP"
|
||||
#if defined(CONFIG_LPC17_LCD_BPP1)
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 1 + 7) / 8)
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP2)
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 2 + 7) / 8)
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP4)
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 4 + 7) / 8)
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP8)
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 8 + 7) / 8)
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP16)
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 16 + 7) / 8)
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP24)
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 32 + 7) / 8)
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP16_565)
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 16 + 7) / 8)
|
||||
#else /* defined(CONFIG_LPC17_LCD_BPP12_444) */
|
||||
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 16 + 7) / 8)
|
||||
#endif
|
||||
|
||||
#define FB_SIZE (FB_STRIDE * CONFIG_LPC17_LCD_VHEIGHT)
|
||||
#define LPC17_FBSIZE (LPC17_STRIDE * CONFIG_LPC17_LCD_VHEIGHT)
|
||||
|
||||
/* Delays */
|
||||
|
||||
@ -124,7 +134,7 @@ static int lpc17_setcursor(FAR struct fb_vtable_s *vtable,
|
||||
|
||||
static const struct fb_videoinfo_s g_videoinfo =
|
||||
{
|
||||
.fmt = FB_FMT,
|
||||
.fmt = LPC17_COLOR_FMT,
|
||||
.xres = CONFIG_LPC17_LCD_HWIDTH,
|
||||
.yres = CONFIG_LPC17_LCD_VHEIGHT,
|
||||
.nplanes = 1,
|
||||
@ -135,9 +145,9 @@ static const struct fb_videoinfo_s g_videoinfo =
|
||||
static const struct fb_planeinfo_s g_planeinfo =
|
||||
{
|
||||
.fbmem = (FAR void *)CONFIG_LPC17_LCD_VRAMBASE,
|
||||
.fblen = FB_SIZE,
|
||||
.stride = FB_STRIDE,
|
||||
.bpp = CONFIG_LPC17_LCD_BPP,
|
||||
.fblen = LPC17_FBSIZE,
|
||||
.stride = LPC17_STRIDE,
|
||||
.bpp = LPC17_BPP,
|
||||
};
|
||||
|
||||
/* Current cursor position */
|
||||
@ -370,7 +380,7 @@ static int lpc17_getcursor(FAR struct fb_vtable_s *vtable,
|
||||
if (vtable && attrib)
|
||||
{
|
||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||
attrib->fmt = FB_FMT;
|
||||
attrib->fmt = LPC17_COLOR_FMT;
|
||||
#endif
|
||||
dbg("pos: (x=%d, y=%d)\n", g_cpos.x, g_cpos.y);
|
||||
attrib->pos = g_cpos;
|
||||
@ -476,7 +486,7 @@ int up_fbinitialize(void)
|
||||
lpc17_configgpio(GPIO_LCD_VD14);
|
||||
lpc17_configgpio(GPIO_LCD_VD15);
|
||||
|
||||
#if CONFIG_LPC17_LCD_BPP == 24
|
||||
#if LPC17_BPP > 16
|
||||
lpc17_configgpio(GPIO_LCD_VD16);
|
||||
lpc17_configgpio(GPIO_LCD_VD17);
|
||||
lpc17_configgpio(GPIO_LCD_VD18);
|
||||
@ -516,14 +526,33 @@ int up_fbinitialize(void)
|
||||
regval = getreg32(LPC17_LCD_CTRL);
|
||||
regval &= ~LCD_CTRL_LCDBPP_MASK;
|
||||
|
||||
#if CONFIG_LPC17_LCD_BPP == 16
|
||||
regval |= LCD_CTRL_LCDBPP_565; /* 16-bit 5:6:5 */
|
||||
#else /* if CONFIG_LPC17_LCD_BPP == 24 */
|
||||
#if defined(CONFIG_LPC17_LCD_BPP1)
|
||||
regval |= LCD_CTRL_LCDBPP_1; /* 1 bpp */
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP2)
|
||||
regval |= LCD_CTRL_LCDBPP_2; /* 2 bpp */
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP4)
|
||||
regval |= LCD_CTRL_LCDBPP_4; /* 4 bpp */
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP8)
|
||||
regval |= LCD_CTRL_LCDBPP_8; /* 8 bpp */
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP16)
|
||||
regval |= LCD_CTRL_LCDBPP_16; /* 16 bpp */
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP24)
|
||||
regval |= LCD_CTRL_LCDBPP_24; /* 24-bit TFT panel only */
|
||||
regval |= LCD_CTRL_LCDTFT;
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP16_565)
|
||||
regval |= LCD_CTRL_LCDBPP_565; /* 16 bpp, 5:6:5 mode */
|
||||
#else /* defined(CONFIG_LPC17_LCD_BPP12_444) */
|
||||
regval |= LCD_CTRL_LCDBPP_444; /* 12 bpp, 4:4:4 mode */
|
||||
#endif
|
||||
|
||||
putreg32(regval, LPC17_LCD_CTRL);
|
||||
|
||||
/* TFT panel */
|
||||
|
||||
#if CONFIG_LPC17_LCD_TFTPANEL
|
||||
regval |= LCD_CTRL_LCDTFT;
|
||||
putreg32(regval, LPC17_LCD_CTRL);
|
||||
#endif
|
||||
|
||||
/* Single panel */
|
||||
|
||||
regval &= ~LCD_CTRL_LCDDUAL;
|
||||
@ -684,10 +713,10 @@ void fb_uninitialize(void)
|
||||
|
||||
void lpc17_lcdclear(nxgl_mxpixel_t color)
|
||||
{
|
||||
#if CONFIG_LPC17_LCD_BPP == 16
|
||||
uint16_t *dest;
|
||||
#else
|
||||
#if LPC17_BPP > 16
|
||||
uint32_t *dest;
|
||||
#else
|
||||
uint16_t *dest;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
|
@ -62,23 +62,52 @@
|
||||
# define CONFIG_LPC17_LCD_REFRESH_FREQ (50) /* Hz */
|
||||
#endif
|
||||
|
||||
/* Bits per pixel */
|
||||
/* Bits per pixel / color format */
|
||||
|
||||
#ifndef CONFIG_LPC17_LCD_BPP
|
||||
# define CONFIG_LPC17_LCD_BPP 24 /* Bits per pixel */
|
||||
#endif
|
||||
|
||||
/* Color format */
|
||||
|
||||
#undef FB_FMT
|
||||
#if CONFIG_LPC17_LCD_BPP == 16
|
||||
# define FB_FMT FB_FMT_RGB16_565
|
||||
#elif CONFIG_LPC17_LCD_BPP == 24
|
||||
# define FB_FMT FB_FMT_RGB24
|
||||
#undef LPC17_COLOR_FMT
|
||||
#if defined(CONFIG_LPC17_LCD_BPP1)
|
||||
# define LPC17_BPP 1
|
||||
# define LPC17_COLOR_FMT FB_FMT_Y1
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP2)
|
||||
# define LPC17_BPP 2
|
||||
# define LPC17_COLOR_FMT FB_FMT_Y2
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP4)
|
||||
# define LPC17_BPP 4
|
||||
# define LPC17_COLOR_FMT FB_FMT_Y4
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP8)
|
||||
# define LPC17_BPP 8
|
||||
# define LPC17_COLOR_FMT FB_FMT_Y8
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP16)
|
||||
# define LPC17_BPP 16
|
||||
# define LPC17_COLOR_FMT FB_FMT_Y16
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP24)
|
||||
# define LPC17_BPP 24
|
||||
# define LPC17_COLOR_FMT FB_FMT_RGB24
|
||||
# ifndef CONFIG_LPC17_LCD_TFTPANEL
|
||||
# error "24 BPP is only available for a TFT panel"
|
||||
# endif
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP16_565)
|
||||
# define LPC17_BPP 16
|
||||
# define LPC17_COLOR_FMT FB_FMT_RGB16_565
|
||||
#elif defined(CONFIG_LPC17_LCD_BPP12_444)
|
||||
# define LPC17_BPP 1 2
|
||||
# define LPC17_COLOR_FMT FB_FMT_RGB12_444
|
||||
#else
|
||||
# error "Unsupported BPP"
|
||||
# ifndef CONFIG_LPC17_LCD_TFTPANEL
|
||||
# warning "Assuming 24 BPP"
|
||||
# define LPC17_BPP 24
|
||||
# define CONFIG_LPC17_LCD_BPP24 1
|
||||
# define LPC17_COLOR_FMT FB_FMT_RGB24
|
||||
# else
|
||||
# warning "Assuming 16 BPP 5:6:5"
|
||||
# define LPC17_BPP 16
|
||||
# define CONFIG_LPC17_LCD_BPP16_565 1
|
||||
# define LPC17_COLOR_FMT FB_FMT_RGB16_565
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Background color */
|
||||
|
||||
#ifndef CONFIG_LPC17_LCD_BACKCOLOR
|
||||
# define CONFIG_LPC17_LCD_BACKCOLOR 0 /* Initial background color */
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user