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---
|
---help---
|
||||||
LCD refesh rate (Hz)
|
LCD refesh rate (Hz)
|
||||||
|
|
||||||
config LPC17_LCD_BPP
|
config LPC17_LCD_TFTPANEL
|
||||||
int "Bits per pixel"
|
bool "TFT Panel"
|
||||||
default 24
|
default y
|
||||||
---help---
|
---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
|
config LPC17_LCD_BACKCOLOR
|
||||||
hex "Initial background color"
|
hex "Initial background color"
|
||||||
|
@ -62,15 +62,25 @@
|
|||||||
|
|
||||||
/* Framebuffer characteristics in bytes */
|
/* Framebuffer characteristics in bytes */
|
||||||
|
|
||||||
#if CONFIG_LPC17_LCD_BPP == 16
|
#if defined(CONFIG_LPC17_LCD_BPP1)
|
||||||
# define FB_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * sizeof(uint16_t) + 7) / 8)
|
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 1 + 7) / 8)
|
||||||
#elif CONFIG_LPC17_LCD_BPP == 24
|
#elif defined(CONFIG_LPC17_LCD_BPP2)
|
||||||
# define FB_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * sizeof(uint32_t) + 7) / 8)
|
# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 2 + 7) / 8)
|
||||||
#else
|
#elif defined(CONFIG_LPC17_LCD_BPP4)
|
||||||
# error "Unsupported BPP"
|
# 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
|
#endif
|
||||||
|
|
||||||
#define FB_SIZE (FB_STRIDE * CONFIG_LPC17_LCD_VHEIGHT)
|
#define LPC17_FBSIZE (LPC17_STRIDE * CONFIG_LPC17_LCD_VHEIGHT)
|
||||||
|
|
||||||
/* Delays */
|
/* Delays */
|
||||||
|
|
||||||
@ -124,7 +134,7 @@ static int lpc17_setcursor(FAR struct fb_vtable_s *vtable,
|
|||||||
|
|
||||||
static const struct fb_videoinfo_s g_videoinfo =
|
static const struct fb_videoinfo_s g_videoinfo =
|
||||||
{
|
{
|
||||||
.fmt = FB_FMT,
|
.fmt = LPC17_COLOR_FMT,
|
||||||
.xres = CONFIG_LPC17_LCD_HWIDTH,
|
.xres = CONFIG_LPC17_LCD_HWIDTH,
|
||||||
.yres = CONFIG_LPC17_LCD_VHEIGHT,
|
.yres = CONFIG_LPC17_LCD_VHEIGHT,
|
||||||
.nplanes = 1,
|
.nplanes = 1,
|
||||||
@ -135,9 +145,9 @@ static const struct fb_videoinfo_s g_videoinfo =
|
|||||||
static const struct fb_planeinfo_s g_planeinfo =
|
static const struct fb_planeinfo_s g_planeinfo =
|
||||||
{
|
{
|
||||||
.fbmem = (FAR void *)CONFIG_LPC17_LCD_VRAMBASE,
|
.fbmem = (FAR void *)CONFIG_LPC17_LCD_VRAMBASE,
|
||||||
.fblen = FB_SIZE,
|
.fblen = LPC17_FBSIZE,
|
||||||
.stride = FB_STRIDE,
|
.stride = LPC17_STRIDE,
|
||||||
.bpp = CONFIG_LPC17_LCD_BPP,
|
.bpp = LPC17_BPP,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Current cursor position */
|
/* Current cursor position */
|
||||||
@ -316,7 +326,7 @@ static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
|
|||||||
if ((i & 1) != 0)
|
if ((i & 1) != 0)
|
||||||
{
|
{
|
||||||
rgb0 = *pal;
|
rgb0 = *pal;
|
||||||
rgb0 &= (LCD_PAL_R0_MASK | LCD_PAL_G0_MASK | LCD_PAL_B0_MASK | LCD_PAL_I0);
|
rgb0 &= (LCD_PAL_R0_MASK | LCD_PAL_G0_MASK | LCD_PAL_B0_MASK | LCD_PAL_I0);
|
||||||
rgb1 |= ((uint32_t)cmap->red[i] << LCD_PAL_R0_SHIFT |
|
rgb1 |= ((uint32_t)cmap->red[i] << LCD_PAL_R0_SHIFT |
|
||||||
(uint32_t)cmap->green[i] << LCD_PAL_G0_SHIFT |
|
(uint32_t)cmap->green[i] << LCD_PAL_G0_SHIFT |
|
||||||
(uint32_t)cmap->blue[i] << LCD_PAL_B0_SHIFT);
|
(uint32_t)cmap->blue[i] << LCD_PAL_B0_SHIFT);
|
||||||
@ -340,7 +350,7 @@ static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
|
|||||||
if ((i + 1) >= last)
|
if ((i + 1) >= last)
|
||||||
{
|
{
|
||||||
rgb1 = *pal;
|
rgb1 = *pal;
|
||||||
rgb1 &= (LCD_PAL_R1_MASK | LCD_PAL_G1_MASK | LCD_PAL_B1_MASK | LCD_PAL_I1);
|
rgb1 &= (LCD_PAL_R1_MASK | LCD_PAL_G1_MASK | LCD_PAL_B1_MASK | LCD_PAL_I1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -370,7 +380,7 @@ static int lpc17_getcursor(FAR struct fb_vtable_s *vtable,
|
|||||||
if (vtable && attrib)
|
if (vtable && attrib)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_FB_HWCURSORIMAGE
|
#ifdef CONFIG_FB_HWCURSORIMAGE
|
||||||
attrib->fmt = FB_FMT;
|
attrib->fmt = LPC17_COLOR_FMT;
|
||||||
#endif
|
#endif
|
||||||
dbg("pos: (x=%d, y=%d)\n", g_cpos.x, g_cpos.y);
|
dbg("pos: (x=%d, y=%d)\n", g_cpos.x, g_cpos.y);
|
||||||
attrib->pos = g_cpos;
|
attrib->pos = g_cpos;
|
||||||
@ -449,7 +459,7 @@ int up_fbinitialize(void)
|
|||||||
regval = getreg32(LPC17_LCD_CTRL);
|
regval = getreg32(LPC17_LCD_CTRL);
|
||||||
regval &= ~LCD_CTRL_LCDPWR;
|
regval &= ~LCD_CTRL_LCDPWR;
|
||||||
putreg32(regval, LPC17_LCD_CTRL);
|
putreg32(regval, LPC17_LCD_CTRL);
|
||||||
|
|
||||||
for (i = LPC17_LCD_PWRDIS_DELAY; i; i--);
|
for (i = LPC17_LCD_PWRDIS_DELAY; i; i--);
|
||||||
|
|
||||||
regval &= ~LCD_CTRL_LCDEN;
|
regval &= ~LCD_CTRL_LCDEN;
|
||||||
@ -476,7 +486,7 @@ int up_fbinitialize(void)
|
|||||||
lpc17_configgpio(GPIO_LCD_VD14);
|
lpc17_configgpio(GPIO_LCD_VD14);
|
||||||
lpc17_configgpio(GPIO_LCD_VD15);
|
lpc17_configgpio(GPIO_LCD_VD15);
|
||||||
|
|
||||||
#if CONFIG_LPC17_LCD_BPP == 24
|
#if LPC17_BPP > 16
|
||||||
lpc17_configgpio(GPIO_LCD_VD16);
|
lpc17_configgpio(GPIO_LCD_VD16);
|
||||||
lpc17_configgpio(GPIO_LCD_VD17);
|
lpc17_configgpio(GPIO_LCD_VD17);
|
||||||
lpc17_configgpio(GPIO_LCD_VD18);
|
lpc17_configgpio(GPIO_LCD_VD18);
|
||||||
@ -515,15 +525,34 @@ int up_fbinitialize(void)
|
|||||||
|
|
||||||
regval = getreg32(LPC17_LCD_CTRL);
|
regval = getreg32(LPC17_LCD_CTRL);
|
||||||
regval &= ~LCD_CTRL_LCDBPP_MASK;
|
regval &= ~LCD_CTRL_LCDBPP_MASK;
|
||||||
|
|
||||||
#if CONFIG_LPC17_LCD_BPP == 16
|
#if defined(CONFIG_LPC17_LCD_BPP1)
|
||||||
regval |= LCD_CTRL_LCDBPP_565; /* 16-bit 5:6:5 */
|
regval |= LCD_CTRL_LCDBPP_1; /* 1 bpp */
|
||||||
#else /* if CONFIG_LPC17_LCD_BPP == 24 */
|
#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_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
|
#endif
|
||||||
|
|
||||||
putreg32(regval, LPC17_LCD_CTRL);
|
putreg32(regval, LPC17_LCD_CTRL);
|
||||||
|
|
||||||
|
/* TFT panel */
|
||||||
|
|
||||||
|
#if CONFIG_LPC17_LCD_TFTPANEL
|
||||||
|
regval |= LCD_CTRL_LCDTFT;
|
||||||
|
putreg32(regval, LPC17_LCD_CTRL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Single panel */
|
/* Single panel */
|
||||||
|
|
||||||
regval &= ~LCD_CTRL_LCDDUAL;
|
regval &= ~LCD_CTRL_LCDDUAL;
|
||||||
@ -603,7 +632,7 @@ int up_fbinitialize(void)
|
|||||||
putreg32(0, LPC17_LCD_TIMV);
|
putreg32(0, LPC17_LCD_TIMV);
|
||||||
|
|
||||||
regval = ((CONFIG_LPC17_LCD_VHEIGHT - 1) << LCD_TIMV_LPP_SHIFT |
|
regval = ((CONFIG_LPC17_LCD_VHEIGHT - 1) << LCD_TIMV_LPP_SHIFT |
|
||||||
(CONFIG_LPC17_LCD_VPULSE - 1) << LCD_TIMV_VSW_SHIFT |
|
(CONFIG_LPC17_LCD_VPULSE - 1) << LCD_TIMV_VSW_SHIFT |
|
||||||
(CONFIG_LPC17_LCD_VFRONTPORCH) << LCD_TIMV_VFP_SHIFT |
|
(CONFIG_LPC17_LCD_VFRONTPORCH) << LCD_TIMV_VFP_SHIFT |
|
||||||
(CONFIG_LPC17_LCD_VBACKPORCH) << LCD_TIMV_VBP_SHIFT);
|
(CONFIG_LPC17_LCD_VBACKPORCH) << LCD_TIMV_VBP_SHIFT);
|
||||||
|
|
||||||
@ -622,7 +651,7 @@ int up_fbinitialize(void)
|
|||||||
regval = getreg32(LPC17_LCD_CTRL);
|
regval = getreg32(LPC17_LCD_CTRL);
|
||||||
regval |= LCD_CTRL_LCDEN;
|
regval |= LCD_CTRL_LCDEN;
|
||||||
putreg32(regval, LPC17_LCD_CTRL);
|
putreg32(regval, LPC17_LCD_CTRL);
|
||||||
|
|
||||||
for (i = LPC17_LCD_PWREN_DELAY; i; i--);
|
for (i = LPC17_LCD_PWREN_DELAY; i; i--);
|
||||||
|
|
||||||
regval |= LCD_CTRL_LCDPWR;
|
regval |= LCD_CTRL_LCDPWR;
|
||||||
@ -684,10 +713,10 @@ void fb_uninitialize(void)
|
|||||||
|
|
||||||
void lpc17_lcdclear(nxgl_mxpixel_t color)
|
void lpc17_lcdclear(nxgl_mxpixel_t color)
|
||||||
{
|
{
|
||||||
#if CONFIG_LPC17_LCD_BPP == 16
|
#if LPC17_BPP > 16
|
||||||
uint16_t *dest;
|
|
||||||
#else
|
|
||||||
uint32_t *dest;
|
uint32_t *dest;
|
||||||
|
#else
|
||||||
|
uint16_t *dest;
|
||||||
#endif
|
#endif
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -62,23 +62,52 @@
|
|||||||
# define CONFIG_LPC17_LCD_REFRESH_FREQ (50) /* Hz */
|
# define CONFIG_LPC17_LCD_REFRESH_FREQ (50) /* Hz */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Bits per pixel */
|
/* Bits per pixel / color format */
|
||||||
|
|
||||||
#ifndef CONFIG_LPC17_LCD_BPP
|
#undef LPC17_COLOR_FMT
|
||||||
# define CONFIG_LPC17_LCD_BPP 24 /* Bits per pixel */
|
#if defined(CONFIG_LPC17_LCD_BPP1)
|
||||||
#endif
|
# define LPC17_BPP 1
|
||||||
|
# define LPC17_COLOR_FMT FB_FMT_Y1
|
||||||
/* Color format */
|
#elif defined(CONFIG_LPC17_LCD_BPP2)
|
||||||
|
# define LPC17_BPP 2
|
||||||
#undef FB_FMT
|
# define LPC17_COLOR_FMT FB_FMT_Y2
|
||||||
#if CONFIG_LPC17_LCD_BPP == 16
|
#elif defined(CONFIG_LPC17_LCD_BPP4)
|
||||||
# define FB_FMT FB_FMT_RGB16_565
|
# define LPC17_BPP 4
|
||||||
#elif CONFIG_LPC17_LCD_BPP == 24
|
# define LPC17_COLOR_FMT FB_FMT_Y4
|
||||||
# define FB_FMT FB_FMT_RGB24
|
#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
|
#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
|
#endif
|
||||||
|
|
||||||
|
/* Background color */
|
||||||
|
|
||||||
#ifndef CONFIG_LPC17_LCD_BACKCOLOR
|
#ifndef CONFIG_LPC17_LCD_BACKCOLOR
|
||||||
# define CONFIG_LPC17_LCD_BACKCOLOR 0 /* Initial background color */
|
# define CONFIG_LPC17_LCD_BACKCOLOR 0 /* Initial background color */
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user