Implement reversed portrait mode displays for the STM3210E-EVAL LCD

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3788 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-07-15 03:47:03 +00:00
parent 1662b66e35
commit 2d2f8e6f08
4 changed files with 61 additions and 11 deletions

View File

@ -410,14 +410,14 @@ STM3210E-EVAL-specific Configuration Options
STM3210E-EVAL LCD Hardware Configuration
CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
support. Default is this 320x240 "landscape" orientation
(this setting is informative only... not used).
CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
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.
CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
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.
@ -484,7 +484,7 @@ Where <subdir> is one of the following:
input.
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
CONFIG_LCD_PORTRAIT=y : 240x320
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
nxtext:
------
@ -494,7 +494,7 @@ Where <subdir> is one of the following:
or without the popup windows present.
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
CONFIG_LCD_PORTRAIT=y : 240x320
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
ostest:
------

View File

@ -828,7 +828,8 @@ CONFIG_NX_MXCLIENTMSGS=16
# by CONFIG_LCD_MAXPOWER. Requires CONFIG_STM32_TIM1.
#
CONFIG_LCD_LANDSCAPE=n
CONFIG_LCD_PORTRAIT=y
CONFIG_LCD_PORTRAIT=n
CONFIG_LCD_RPORTRAIT=y
CONFIG_LCD_BACKLIGHT=n
#

View File

@ -828,7 +828,8 @@ CONFIG_NX_MXCLIENTMSGS=16
# by CONFIG_LCD_MAXPOWER. Requires CONFIG_STM32_TIM1.
#
CONFIG_LCD_LANDSCAPE=n
CONFIG_LCD_PORTRAIT=y
CONFIG_LCD_PORTRAIT=n
CONFIG_LCD_RPORTRAIT=y
CONFIG_LCD_BACKLIGHT=n
#

View File

@ -85,8 +85,12 @@
/* Check orientation */
#if defined(CONFIG_LCD_PORTRAIT)
# if defined(CONFIG_LCD_LANDSCAPE)
# error "Cannot define both portrait and landscape orientations"
# if defined(CONFIG_LCD_LANDSCAPE) || 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)
# error "Cannot define both rportrait and any other orientations"
# endif
#elif !defined(CONFIG_LCD_LANDSCAPE)
# define CONFIG_LCD_LANDSCAPE 1
@ -575,7 +579,7 @@ static int stm3210e_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *bu
stm3210e_writegram(*src++);
}
#else /* CONFIG_LCD_PORTRAIT */
#elif defined(CONFIG_LCD_PORTRAIT)
/* Convert coordinates. (Swap row and column. This is done implicitly). */
/* Then write the GRAM data, manually incrementing Y (which is col) */
@ -592,6 +596,28 @@ static int stm3210e_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *bu
col++;
}
#else /* CONFIG_LCD_RPORTRAIT */
/* Convert coordinates. (Swap row and column. This is done implicitly).
* Which edge of the display is the "top"?
*/
col = (STM3210E_XRES-1) - col;
row = (STM3210E_YRES-1) - row;
/* Then write the GRAM data, manually incrementing Y (which is col) */
for (i = 0; i < npixels; i++)
{
/* Write the next pixel to this position */
stm3210e_setcursor(row, col);
stm3210e_gramselect();
stm3210e_writegram(*src++);
/* Decrement to next column */
col--;
}
#endif
return OK;
}
@ -643,7 +669,7 @@ static int stm3210e_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
*dest++ = stm3210e_readgram();
}
#else /* CONFIG_LCD_PORTRAIT */
#elif defined(CONFIG_LCD_PORTRAIT)
/* Convert coordinates (Swap row and column. This is done implicitly). */
/* Then read the GRAM data, manually incrementing Y (which is col) */
@ -660,6 +686,28 @@ static int stm3210e_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
col++;
}
#else /* CONFIG_LCD_RPORTRAIT */
/* Convert coordinates. (Swap row and column. This is done implicitly).
* Whic edge of the display is the "top"?
*/
col = (STM3210E_XRES-1) - col;
row = (STM3210E_YRES-1) - row;
/* Then write the GRAM data, manually incrementing Y (which is col) */
for (i = 0; i < npixels; i++)
{
/* Write the next pixel to this position */
stm3210e_setcursor(row, col);
stm3210e_gramselect();
*dest++ = stm3210e_readgram();
/* Decrement to next column */
col--;
}
#endif
return OK;