NX for 4bpp
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2671 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
e244cdfeb2
commit
80891ed66b
@ -560,15 +560,15 @@ CONFIG_NX_DISABLE_8BPP=y
|
||||
CONFIG_NX_DISABLE_16BPP=y
|
||||
CONFIG_NX_DISABLE_24BPP=y
|
||||
CONFIG_NX_DISABLE_32BPP=y
|
||||
CONFIG_NX_PACKEDMSFIRST=n
|
||||
CONFIG_NX_PACKEDMSFIRST=y
|
||||
CONFIG_NX_LCDDRIVER=y
|
||||
CONFIG_LCD_MAXPOWER=1
|
||||
CONFIG_LCD_MAXCONTRAST=255
|
||||
CONFIG_NX_MOUSE=y
|
||||
CONFIG_NX_KBD=y
|
||||
#CONFIG_NXTK_BORDERWIDTH=4
|
||||
#CONFIG_NXTK_BORDERCOLOR1
|
||||
#CONFIG_NXTK_BORDERCOLOR2
|
||||
CONFIG_NXTK_BORDERCOLOR1=6
|
||||
CONFIG_NXTK_BORDERCOLOR2=4
|
||||
CONFIG_NXTK_AUTORAISE=n
|
||||
CONFIG_NXFONT_SANS=y
|
||||
CONFIG_NXFONTS_CHARBITS=7
|
||||
@ -697,7 +697,7 @@ CONFIG_EXAMPLES_NSH_MMCSDMINOR=0
|
||||
# nx_eventnotify(). Default: 4
|
||||
CONFIG_EXAMPLES_NX_VPLANE=0
|
||||
CONFIG_EXAMPLES_NX_DEVNO=0
|
||||
CONFIG_EXAMPLES_NX_BGCOLOR=4
|
||||
CONFIG_EXAMPLES_NX_BGCOLOR=2
|
||||
CONFIG_EXAMPLES_NX_COLOR1=10
|
||||
CONFIG_EXAMPLES_NX_COLOR2=12
|
||||
CONFIG_EXAMPLES_NX_TBCOLOR=8
|
||||
|
@ -47,6 +47,9 @@
|
||||
#include <nuttx/spi.h>
|
||||
#include <nuttx/p14201.h>
|
||||
|
||||
#include "lm3s_internal.h"
|
||||
#include "lm3s6965ek_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
@ -63,7 +66,7 @@
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function lm3s_oledinitialize(void);
|
||||
void lm3s_oledinitialize(void)
|
||||
{
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
@ -124,6 +124,12 @@
|
||||
# define CONFIG_LCD_MAXPOWER 1
|
||||
#endif
|
||||
|
||||
/* The leftmost column is contained in bits 7:4 */
|
||||
|
||||
#ifndef CONFIG_NX_PACKEDMSFIRST
|
||||
# warning "CONFIG_NX_PACKEDMSFIRST needs to be set"
|
||||
#endif
|
||||
|
||||
/* Define the following to enable register-level debug output */
|
||||
|
||||
#undef CONFIG_LCD_RITDEBUG
|
||||
@ -624,6 +630,10 @@ static inline void rit_clear(FAR struct rit_dev_s *priv)
|
||||
FAR uint8_t *ptr = g_framebuffer;
|
||||
unsigned int row;
|
||||
|
||||
/* Initialize the framebuffer */
|
||||
|
||||
memset(g_framebuffer, (RIT_Y4_BLACK << 4) | RIT_Y4_BLACK, RIT_YRES * RIT_XRES / 2);
|
||||
|
||||
/* Set a window to fill the entire display */
|
||||
|
||||
rit_sndcmd(priv, g_setallcol, sizeof(g_setallcol));
|
||||
@ -698,7 +708,7 @@ static int rit_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
|
||||
|
||||
/* Get the beginning of the run in the framebuffer */
|
||||
|
||||
run = g_framebuffer + row * RIT_XRES / 2 + start;
|
||||
run = g_framebuffer + row * RIT_XRES / 2;
|
||||
|
||||
/* Copy the run into the framebuffer, handling nibble alignment */
|
||||
|
||||
@ -706,14 +716,15 @@ static int rit_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
|
||||
{
|
||||
/* Beginning of buffer is properly aligned */
|
||||
|
||||
memcpy(run, buffer, aend - start);
|
||||
memcpy(&run[start], buffer, aend - start);
|
||||
|
||||
/* Handle an final partial byte */
|
||||
/* Handle any final partial byte */
|
||||
|
||||
if (aend != end)
|
||||
{
|
||||
/* The leftmost column being contained in bits 7:4 */
|
||||
# warning "Missing logic"
|
||||
/* The leftmost column is contained in bits 7:4 */
|
||||
|
||||
run[end] = (run[end] & 0x0f) | (buffer[aend - start] & 0xf0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -833,8 +844,6 @@ static int rit_getvideoinfo(FAR struct lcd_dev_s *dev,
|
||||
static int rit_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
|
||||
FAR struct lcd_planeinfo_s *pinfo)
|
||||
{
|
||||
FAR struct rit_dev_s *priv = (FAR struct rit_dev_s *)dev;
|
||||
|
||||
DEBUGASSERT(priv && pinfo && planeno == 0);
|
||||
gvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
|
||||
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
|
||||
@ -979,12 +988,6 @@ FAR struct lcd_dev_s *rit_initialize(FAR struct spi_dev_s *spi, unsigned int dev
|
||||
priv->contrast = RIT_CONTRAST;
|
||||
priv->on = false;
|
||||
|
||||
/* Initialize the framebuffer */
|
||||
|
||||
#ifdef CONFIG_P14201_FRAMEBUFFER
|
||||
memset(g_framebuffer, (RIT_Y4_BLACK << 4) | RIT_Y4_BLACK, RIT_YRES * RIT_XRES / 2);
|
||||
#endif
|
||||
|
||||
/* Clear the display */
|
||||
|
||||
rit_clear(priv);
|
||||
|
@ -154,6 +154,9 @@ nxeg_renderglyph(FAR struct nxeg_state_s *st,
|
||||
{
|
||||
FAR struct nxeg_glyph_s *glyph = NULL;
|
||||
FAR nxgl_mxpixel_t *ptr;
|
||||
#if CONFIG_EXAMPLES_NX_BPP < 8
|
||||
nxgl_mxpixel_t pixel;
|
||||
#endif
|
||||
int bmsize;
|
||||
int row;
|
||||
int col;
|
||||
@ -184,18 +187,54 @@ nxeg_renderglyph(FAR struct nxeg_state_s *st,
|
||||
{
|
||||
/* Initialize the glyph memory to the background color */
|
||||
|
||||
#if CONFIG_EXAMPLES_NX_BPP < 8 || CONFIG_EXAMPLES_NX_BPP == 24
|
||||
# error "Additional logic is needed here"
|
||||
#else
|
||||
#if CONFIG_EXAMPLES_NX_BPP < 8
|
||||
pixel = st->color[0];
|
||||
# if CONFIG_EXAMPLES_NX_BPP == 1
|
||||
/* Pack 1-bit pixels into a 2-bits */
|
||||
|
||||
pixel &= 0x01;
|
||||
pixel = (pixel) << 1 |pixel;
|
||||
# endif
|
||||
# if CONFIG_EXAMPLES_NX_BPP < 4
|
||||
/* Pack 2-bit pixels into a nibble */
|
||||
|
||||
pixel &= 0x03;
|
||||
pixel = (pixel) << 2 |pixel;
|
||||
# endif
|
||||
|
||||
/* Pack 4-bit nibbles into a byte */
|
||||
|
||||
pixel &= 0x0f;
|
||||
pixel = (pixel) << 4 |pixel;
|
||||
|
||||
ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap;
|
||||
for (row = 0; row < glyph->height; row++)
|
||||
{
|
||||
for (col = 0; col < glyph->stride; col++)
|
||||
{
|
||||
/* Transfer the packed bytes into the buffer */
|
||||
|
||||
*ptr++ = pixel;
|
||||
}
|
||||
}
|
||||
|
||||
#elif CONFIG_EXAMPLES_NX_BPP == 24
|
||||
# error "Additional logic is needed here for 24bpp support"
|
||||
|
||||
#else /* CONFIG_EXAMPLES_NX_BPP = {8,16,32} */
|
||||
|
||||
ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap;
|
||||
for (row = 0; row < glyph->height; row++)
|
||||
{
|
||||
/* Just copy the color value into the glyph memory */
|
||||
|
||||
for (col = 0; col < glyph->width; col++)
|
||||
{
|
||||
*ptr++ = st->color[0];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then render the glyph into the allocated memory */
|
||||
|
||||
ret = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap,
|
||||
|
@ -101,7 +101,7 @@ static inline void nxgl_fillrun_1bpp(FAR uint8_t *run, nxgl_mxpixel_t color,
|
||||
uint8_t wide = (color & 1) != 0 ? 0xff : 0x00;
|
||||
|
||||
/* Fill the run with the color (it is okay to run a fractional byte over
|
||||
* the end
|
||||
* the end)
|
||||
*/
|
||||
|
||||
memset(run, wide, nbytes);
|
||||
@ -120,7 +120,7 @@ static inline void nxgl_fillrun_2bpp(FAR uint8_t *run, nxgl_mxpixel_t color,
|
||||
uint8_t wide = g_wide_2bpp[color & 3];
|
||||
|
||||
/* Fill the run with the color (it is okay to run a fractional byte over
|
||||
* the end
|
||||
* the end)
|
||||
*/
|
||||
|
||||
memset(run, wide, nbytes);
|
||||
@ -140,7 +140,7 @@ static inline void nxgl_fillrun_4bpp(FAR uint8_t *run, nxgl_mxpixel_t color,
|
||||
uint8_t wide = narrow | (narrow << 4);
|
||||
|
||||
/* Fill the run with the color (it is okay to run a fractional byte over
|
||||
* the end
|
||||
* the end)
|
||||
*/
|
||||
|
||||
memset(run, wide, nbytes);
|
||||
|
@ -61,6 +61,8 @@
|
||||
# define CONFIG_NXTK_BORDERCOLOR1 0x00a9a9a9
|
||||
# elif !defined(CONFIG_NX_DISABLE_16BPP)
|
||||
# define CONFIG_NXTK_BORDERCOLOR1 0xad55
|
||||
# elif !defined(CONFIG_NX_DISABLE_4BPP)
|
||||
# define CONFIG_NXTK_BORDERCOLOR1 6
|
||||
# else
|
||||
# define CONFIG_NXTK_BORDERCOLOR1 'B'
|
||||
# endif
|
||||
@ -71,6 +73,8 @@
|
||||
# define CONFIG_NXTK_BORDERCOLOR2 0x00696969
|
||||
# elif !defined(CONFIG_NX_DISABLE_16BPP)
|
||||
# define CONFIG_NXTK_BORDERCOLOR2 0x6b4d
|
||||
# elif !defined(CONFIG_NX_DISABLE_4BPP)
|
||||
# define CONFIG_NXTK_BORDERCOLOR2 4
|
||||
# else
|
||||
# define CONFIG_NXTK_BORDERCOLOR2 'b'
|
||||
# endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user