summaryrefslogtreecommitdiff
path: root/nuttx/drivers/lcd
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-28 19:24:46 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-28 19:24:46 +0000
commitf5fe5b29490d863ea78f4f16f876f08babd6d8a5 (patch)
treeb78d5cf4d68cbe289b7d5e17efc1f24046db992a /nuttx/drivers/lcd
parent42659da2071819559da08116cf1ada64d10b5f80 (diff)
downloadpx4-nuttx-f5fe5b29490d863ea78f4f16f876f08babd6d8a5.tar.gz
px4-nuttx-f5fe5b29490d863ea78f4f16f876f08babd6d8a5.tar.bz2
px4-nuttx-f5fe5b29490d863ea78f4f16f876f08babd6d8a5.zip
Turn off LCD reading on Shenzhou board (needs some TLC before it will be usable)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5202 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/lcd')
-rw-r--r--nuttx/drivers/lcd/ssd1289.c103
1 files changed, 92 insertions, 11 deletions
diff --git a/nuttx/drivers/lcd/ssd1289.c b/nuttx/drivers/lcd/ssd1289.c
index f5f11b87d..e42b5bded 100644
--- a/nuttx/drivers/lcd/ssd1289.c
+++ b/nuttx/drivers/lcd/ssd1289.c
@@ -229,8 +229,8 @@
/* Debug ******************************************************************************/
#ifdef CONFIG_DEBUG_LCD
-# define lcddbg dbg
-# define lcdvdbg vdbg
+# define lcddbg dbg
+# define lcdvdbg vdbg
#else
# define lcddbg(x...)
# define lcdvdbg(x...)
@@ -253,6 +253,16 @@ struct ssd1289_dev_s
FAR struct ssd1289_lcd_s *lcd; /* The contained platform-specific, LCD interface */
uint8_t power; /* Current power setting */
+ /* These fields simplify and reduce debug output */
+
+#ifdef CONFIG_DEBUG_LCD
+ bool put; /* Last raster operation was a putrun */
+ fb_coord_t firstrow; /* First row of the run */
+ fb_coord_t lastrow; /* Last row of the run */
+ fb_coord_t col; /* Column of the run */
+ size_t npixels; /* Length of the run */
+#endif
+
/* This is working memory allocated by the LCD driver for each LCD device
* and for each color plane. This memory will hold one raster line of data.
* The size of the allocated run buffer must therefore be at least
@@ -287,6 +297,19 @@ static void ssd1289_setcursor(FAR struct ssd1289_lcd_s *lcd, uint16_t column,
/* LCD Data Transfer Methods */
+#if 0 /* Sometimes useful */
+static void ssd1289_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels);
+#else
+# define ssd1289_dumprun(m,r,n)
+#endif
+
+#ifdef CONFIG_DEBUG_LCD
+static void ssd1289_showrun(FAR struct ssd1289_dev_s *priv, fb_coord_t row,
+ fb_coord_t col, size_t npixels, bool put);
+#else
+# define ssd1289_showrun(p,r,c,n,b)
+#endif
+
static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels);
static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
@@ -489,6 +512,64 @@ static void ssd1289_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixe
#endif
/**************************************************************************************
+ * Name: ssd1289_showrun
+ *
+ * Description:
+ * When LCD debug is enabled, try to reduce then amount of ouptut data generated by
+ * ssd1289_putrun and ssd1289_getrun
+ *
+ **************************************************************************************/
+
+#ifdef CONFIG_DEBUG_LCD
+static void ssd1289_showrun(FAR struct ssd1289_dev_s *priv, fb_coord_t row,
+ fb_coord_t col, size_t npixels, bool put)
+{
+ fb_coord_t nextrow = priv->lastrow + 1;
+
+ /* Has anything changed (other than the row is the next row in the sequence)? */
+
+ if (put == priv->put && row == nextrow && col == priv->col &&
+ npixels == priv->npixels)
+ {
+ /* No, just update the last row */
+
+ priv->lastrow = nextrow;
+ }
+ else
+ {
+ /* Yes... then this is the end of the preceding sequence. Output the last run
+ * (if there were more than one run in the sequence).
+ */
+
+ if (priv->firstrow != priv->lastrow)
+ {
+ lcddbg("...\n");
+ lcddbg("%s row: %d col: %d npixels: %d\n",
+ priv->put ? "PUT" : "GET",
+ priv->lastrow, priv->col, priv->npixels);
+ }
+
+ /* And we are starting a new sequence. Output the first run of the
+ * new sequence
+ */
+
+ lcddbg("%s row: %d col: %d npixels: %d\n",
+ put ? "PUT" : "GET", row, col, npixels);
+
+ /* And save information about the run so that we can detect continuations
+ * of the sequence.
+ */
+
+ priv->put = put;
+ priv->firstrow = row;
+ priv->lastrow = row;
+ priv->col = col;
+ priv->npixels = npixels;
+ }
+}
+#endif
+
+/**************************************************************************************
* Name: ssd1289_putrun
*
* Description:
@@ -512,7 +593,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf
/* Buffer must be provided and aligned to a 16-bit address boundary */
- lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ ssd1289_showrun(priv, row, col, npixels, true);
DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
/* Select the LCD */
@@ -536,7 +617,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf
ssd1289_gramselect(lcd);
ssd1289_gramwrite(lcd, *src);
- /* Increment to next column */
+ /* Increment to the next column */
src++;
col++;
@@ -581,7 +662,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf
ssd1289_gramselect(lcd);
ssd1289_gramwrite(lcd, *src);
- /* Increment to next column */
+ /* Increment to the next column */
src++;
col--;
@@ -604,7 +685,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf
ssd1289_gramselect(lcd);
ssd1289_gramwrite(lcd, *src);
- /* Decrement to next column */
+ /* Decrement to the next column */
src++;
col++;
@@ -632,7 +713,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buf
**************************************************************************************/
static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
- size_t npixels)
+ size_t npixels)
{
#ifndef CONFIG_LCD_NOGETRUN
FAR struct ssd1289_dev_s *priv = &g_lcddev;
@@ -643,7 +724,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
/* Buffer must be provided and aligned to a 16-bit address boundary */
- lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ ssd1289_showrun(priv, row, col, npixels, false);
DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
/* Select the LCD */
@@ -666,7 +747,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
ssd1289_readsetup(lcd, &accum);
*dest++ = ssd1289_gramread(lcd, &accum);
- /* Increment to next column */
+ /* Increment to the next column */
col++;
}
@@ -715,7 +796,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
ssd1289_readsetup(lcd, &accum);
*dest++ = ssd1289_gramread(lcd, &accum);
- /* Increment to next column */
+ /* Increment to the next column */
col--;
}
@@ -738,7 +819,7 @@ static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
ssd1289_readsetup(lcd, &accum);
*dest++ = ssd1289_gramread(lcd, &accum);
- /* Decrement to next column */
+ /* Decrement to the next column */
col++;
}