diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-15 03:47:03 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-15 03:47:03 +0000 |
commit | a63f296210924e253c7932ad880a2e8ac83295d7 (patch) | |
tree | 2b725483b114a769c5141a0bb37fff73d3dd2998 | |
parent | 94b2a0793f55c1d107c261c5bea8e42dd7e2da2a (diff) | |
download | nuttx-a63f296210924e253c7932ad880a2e8ac83295d7.tar.gz nuttx-a63f296210924e253c7932ad880a2e8ac83295d7.tar.bz2 nuttx-a63f296210924e253c7932ad880a2e8ac83295d7.zip |
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
-rwxr-xr-x | nuttx/configs/stm3210e-eval/README.txt | 10 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/nx/defconfig | 3 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/nxtext/defconfig | 3 | ||||
-rwxr-xr-x | nuttx/configs/stm3210e-eval/src/up_lcd.c | 56 |
4 files changed, 61 insertions, 11 deletions
diff --git a/nuttx/configs/stm3210e-eval/README.txt b/nuttx/configs/stm3210e-eval/README.txt index 70e40b694..8dac8289f 100755 --- a/nuttx/configs/stm3210e-eval/README.txt +++ b/nuttx/configs/stm3210e-eval/README.txt @@ -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: ------ diff --git a/nuttx/configs/stm3210e-eval/nx/defconfig b/nuttx/configs/stm3210e-eval/nx/defconfig index 60f86875d..e65bfe469 100644 --- a/nuttx/configs/stm3210e-eval/nx/defconfig +++ b/nuttx/configs/stm3210e-eval/nx/defconfig @@ -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 # diff --git a/nuttx/configs/stm3210e-eval/nxtext/defconfig b/nuttx/configs/stm3210e-eval/nxtext/defconfig index a2ddaa218..c97285022 100644 --- a/nuttx/configs/stm3210e-eval/nxtext/defconfig +++ b/nuttx/configs/stm3210e-eval/nxtext/defconfig @@ -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 # diff --git a/nuttx/configs/stm3210e-eval/src/up_lcd.c b/nuttx/configs/stm3210e-eval/src/up_lcd.c index a888f31e5..a183a04cb 100755 --- a/nuttx/configs/stm3210e-eval/src/up_lcd.c +++ b/nuttx/configs/stm3210e-eval/src/up_lcd.c @@ -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; |