Fix/verify the STM32 LCD in all supported orientations

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4666 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-04-27 20:59:49 +00:00
parent 38648921fd
commit f5b68e5424
6 changed files with 129 additions and 44 deletions

View File

@ -30,7 +30,19 @@ config LCD_LANDSCAPE
bool "320x240 landscape display"
---help---
Define for 320x240 display "landscape" support. Default is this 320x240
"landscape" orientation (this setting is informative only... not used).
"landscape" orientation.
For the STM3240G-EVAL board, the edge opposite from the row of buttons
is used as the top of the display in this orientation.
config LCD_RLANDSCAPE
bool "320x240 reverse landscape display"
---help---
Define for 320x240 display "reverse landscape" support. Default is this 320x240
"landscape" orientation.
For the STM3240G-EVAL board, the edge next to the row of buttons
is used as the top of the display in this orientation.
config LCD_PORTRAIT
bool "240x320 portrait display"
@ -39,6 +51,10 @@ config LCD_PORTRAIT
orientation, the STM3210E-EVAL's LCD ribbon cable is at the bottom of
the display. Default is 320x240 "landscape" orientation.
In this orientation, the top of the display is to the left
of the buttons (if the board is held so that the buttons are at the
botton of the board).
config LCD_RPORTRAIT
bool "240x320 reverse portrait display"
---help---
@ -46,6 +62,10 @@ config LCD_RPORTRAIT
this orientation, the STM3210E-EVAL's LCD ribbon cable is at the top
of the display. Default is 320x240 "landscape" orientation.
In this orientation, the top of the display is to the right
of the buttons (if the board is held so that the buttons are at the
botton of the board).
endchoice
config LCD_RDSHIFT

View File

@ -777,22 +777,27 @@ STM3240G-EVAL-specific Configuration Options
CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
support. Default is this 320x240 "landscape" orientation
(this setting is informative only... not used).
For the STM3240G-EVAL board, the edge opposite from the row of buttons
is used as the top of the display in this orientation.
CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse
landscape" support. Default is this 320x240 "landscape"
orientation
For the STM3240G-EVAL board, the edge next to the row of buttons
is used as the top of the display in this orientation.
CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
orientation support. In this orientation, the STM3210E-EVAL's
LCD ribbon cable is at the bottom of the display. Default is
320x240 "landscape" orientation.
In this orientation, the top of the display is to the left
of the buttons (if the board is held so that the buttons are at the
botton of the board).
CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
portrait" orientation support. In this orientation, the
STM3210E-EVAL's LCD ribbon cable is at the top of the display.
Default is 320x240 "landscape" orientation.
CONFIG_LCD_BACKLIGHT - Define to support a backlight.
CONFIG_LCD_PWM - If CONFIG_STM32_TIM1 is also defined, then an
adjustable backlight will be provided using timer 1 to generate
various pulse widthes. The granularity of the settings is
determined by CONFIG_LCD_MAXPOWER. If CONFIG_LCD_PWM (or
CONFIG_STM32_TIM1) is not defined, then a simple on/off backlight
is provided.
In this orientation, the top of the display is to the right
of the buttons (if the board is held so that the buttons are at the
botton of the board).
CONFIG_LCD_RDSHIFT - When reading 16-bit gram data, there appears
to be a shift in the returned data. This value fixes the offset.
Default 5.

View File

@ -1245,7 +1245,9 @@ CONFIG_NXCONSOLE_CACHESIZE=32
#
# CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
# support. Default is this 320x240 "landscape" orientation
# (this setting is informative only... not used).
# CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse
# landscape" support. Default is this 320x240 "landscape"
# orientation
# CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
# orientation support. In this orientation, the STM3240G-EVAL's
# LCD ribbon cable is at the bottom of the display. Default is
@ -1256,6 +1258,7 @@ CONFIG_NXCONSOLE_CACHESIZE=32
# Default is 320x240 "landscape" orientation.
#
CONFIG_LCD_LANDSCAPE=n
CONFIG_LCD_RLANDSCAPE=n
CONFIG_LCD_PORTRAIT=n
CONFIG_LCD_RPORTRAIT=y

View File

@ -1246,6 +1246,9 @@ CONFIG_NXCONSOLE_CACHESIZE=32
# CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
# support. Default is this 320x240 "landscape" orientation
# (this setting is informative only... not used).
# CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse
# landscape" support. Default is this 320x240 "landscape"
# orientation
# CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
# orientation support. In this orientation, the STM3240G-EVAL's
# LCD ribbon cable is at the bottom of the display. Default is
@ -1256,10 +1259,10 @@ CONFIG_NXCONSOLE_CACHESIZE=32
# Default is 320x240 "landscape" orientation.
#
CONFIG_LCD_LANDSCAPE=y
CONFIG_LCD_RLANDSCAPE=n
CONFIG_LCD_PORTRAIT=n
CONFIG_LCD_RPORTRAIT=n
#
# STM3240G-EVAL specific LCD settings
#

View File

@ -1092,7 +1092,9 @@ CONFIG_NXWIDGETS_DEFAULT_FONTID=5
#
# CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
# support. Default is this 320x240 "landscape" orientation
# (this setting is informative only... not used).
# CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse
# landscape" support. Default is this 320x240 "landscape"
# orientation
# CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
# orientation support. In this orientation, the PT3's
# LCD ribbon cable is at the bottom of the display. Default is
@ -1101,22 +1103,17 @@ CONFIG_NXWIDGETS_DEFAULT_FONTID=5
# portrait" orientation support. In this orientation, the
# STM3240G-EVAL's LCD ribbon cable is at the top of the display.
# Default is 320x240 "landscape" orientation.
# CONFIG_LCD_BACKLIGHT - Define to support a backlight.
# CONFIG_LCD_PWM - If CONFIG_STM32_TIM1 is also defined, then an
# adjustable backlight will be provided using timer 1 to generate
# various pulse widthes. The granularity of the settings is
# determined by CONFIG_LCD_MAXPOWER. If CONFIG_LCD_PWM (or
# CONFIG_STM32_TIM1) is not defined, then a simple on/off backlight
# is provided.
#
CONFIG_LCD_LANDSCAPE=n
CONFIG_LCD_RLANDSCAPE=n
CONFIG_LCD_PORTRAIT=n
CONFIG_LCD_RPORTRAIT=y
CONFIG_LCD_BACKLIGHT=y
CONFIG_LCD_PWM=n
CONFIG_STM32_AM240320_DISABLE=y
CONFIG_STM32_SPFD5408B_DISABLE=n
CONFIG_STM32_R61580_DISABLE=n
#
# STM3240G-EVAL specific LCD settings
#
CONFIG_STM32_ILI9320_DISABLE=n
CONFIG_STM32_ILI9325_DISABLE=n
#
# Settings for examples/uip

View File

@ -93,14 +93,18 @@
/* Check orientation */
#if defined(CONFIG_LCD_PORTRAIT)
# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RPORTRAIT)
# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) || defined(CONFIG_LCD_RPORTRAIT)
# error "Cannot define both portrait and any other orientations"
# endif
#elif defined(CONFIG_LCD_RPORTRAIT)
# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_PORTRAIT)
# if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
# error "Cannot define both rportrait and any other orientations"
# endif
#elif !defined(CONFIG_LCD_LANDSCAPE)
#elif defined(CONFIG_LCD_LANDSCAPE)
# ifdef defined(CONFIG_LCD_RLANDSCAPE)
# error "Cannot define both landscape and any other orientations"
# endif
#elif !defined(CONFIG_LCD_RLANDSCAPE)
# define CONFIG_LCD_LANDSCAPE 1
#endif
@ -121,7 +125,7 @@
/* Display/Color Properties ***********************************************************/
/* Display Resolution */
#ifdef CONFIG_LCD_LANDSCAPE
#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
# define STM3240G_XRES 320
# define STM3240G_YRES 240
#else
@ -585,11 +589,35 @@ static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *bu
/* Write the run to GRAM. */
#ifdef CONFIG_LCD_LANDSCAPE
/* Convert coordinates -- Which edge of the display is the "top?" Here the edge
* with the simplest conversion is used.
/* Convert coordinates -- Here the edge away from the row of buttons on
* the STM3240G-EVAL is used as the top.
*/
/* Set the cursor position */
stm3240g_setcursor(col, row);
/* Then write the GRAM data, manually incrementing X */
for (i = 0; i < npixels; i++)
{
/* Write the next pixel to this position */
stm3240g_setcursor(col, row);
stm3240g_gramselect();
stm3240g_writegram(*src++);
/* Increment to next column */
col++;
}
#elif defined(CONFIG_LCD_RLANDSCAPE)
/* Convert coordinates -- Here the edge next to the row of buttons on
* the STM3240G-EVAL is used as the top.
*/
col = (STM3240G_XRES-1) - col;
row = (STM3240G_YRES-1) - row;
/* Set the cursor position */
@ -605,7 +633,12 @@ static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *bu
stm3240g_writegram(*src++);
}
#elif defined(CONFIG_LCD_PORTRAIT)
/* Convert coordinates. (Swap row and column. This is done implicitly). */
/* Convert coordinates. In this configuration, the top of the display is to the left
* of the buttons (if the board is held so that the buttons are at the botton of the
* board).
*/
col = (STM3240G_XRES-1) - col;
/* Then write the GRAM data, manually incrementing Y (which is col) */
@ -619,14 +652,14 @@ static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *bu
/* Increment to next column */
col++;
col--;
}
#else /* CONFIG_LCD_RPORTRAIT */
/* Convert coordinates. (Swap row and column. This is done implicitly).
* Which edge of the display is the "top"?
/* Convert coordinates. In this configuration, the top of the display is to the right
* of the buttons (if the board is held so that the buttons are at the botton of the
* board).
*/
col = (STM3240G_XRES-1) - col;
row = (STM3240G_YRES-1) - row;
/* Then write the GRAM data, manually incrementing Y (which is col) */
@ -641,7 +674,7 @@ static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *bu
/* Decrement to next column */
col--;
col++;
}
#endif
return OK;
@ -698,11 +731,30 @@ static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
/* Read the run from GRAM. */
#ifdef CONFIG_LCD_LANDSCAPE
/* Convert coordinates -- Which edge of the display is the "top?" Here the edge
* with the simplest conversion is used.
/* Convert coordinates -- Here the edge away from the row of buttons on
* the STM3240G-EVAL is used as the top.
*/
for (i = 0; i < npixels; i++)
{
/* Read the next pixel from this position */
stm3240g_setcursor(row, col);
stm3240g_gramselect();
readsetup(&accum);
*dest++ = readgram(&accum);
/* Increment to next column */
col++;
}
#elif defined(CONFIG_LCD_RLANDSCAPE)
/* Convert coordinates -- Here the edge next to the row of buttons on
* the STM3240G-EVAL is used as the top.
*/
col = (STM3240G_XRES-1) - col;
row = (STM3240G_YRES-1) - row;
/* Set the cursor position */
@ -723,7 +775,12 @@ static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
*dest++ = readgram(&accum);
}
#elif defined(CONFIG_LCD_PORTRAIT)
/* Convert coordinates (Swap row and column. This is done implicitly). */
/* Convert coordinates. In this configuration, the top of the display is to the left
* of the buttons (if the board is held so that the buttons are at the botton of the
* board).
*/
col = (STM3240G_XRES-1) - col;
/* Then read the GRAM data, manually incrementing Y (which is col) */
@ -738,14 +795,14 @@ static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
/* Increment to next column */
col++;
col--;
}
#else /* CONFIG_LCD_RPORTRAIT */
/* Convert coordinates. (Swap row and column. This is done implicitly).
* Whic edge of the display is the "top"?
/* Convert coordinates. In this configuration, the top of the display is to the right
* of the buttons (if the board is held so that the buttons are at the botton of the
* board).
*/
col = (STM3240G_XRES-1) - col;
row = (STM3240G_YRES-1) - row;
/* Then write the GRAM data, manually incrementing Y (which is col) */
@ -761,7 +818,7 @@ static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
/* Decrement to next column */
col--;
col++;
}
#endif