diff options
author | Joel Bodenmann <joel@seriouslyembedded.com> | 2015-06-21 09:51:05 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@seriouslyembedded.com> | 2015-06-21 09:51:05 +0200 |
commit | fe7b378a7b850b893e236975ca2f9532c2114113 (patch) | |
tree | 6f6b463c9c0599bc8577c67930d37dc58e7df637 /drivers/gdisp/SSD1963 | |
parent | 5abc1dbb23c3651c4b7c0549d8df7f938a2311da (diff) | |
download | uGFX-fe7b378a7b850b893e236975ca2f9532c2114113.tar.gz uGFX-fe7b378a7b850b893e236975ca2f9532c2114113.tar.bz2 uGFX-fe7b378a7b850b893e236975ca2f9532c2114113.zip |
Adding 'flipHorizontally' and 'flipVertically^optiony to SSD1963
Diffstat (limited to 'drivers/gdisp/SSD1963')
-rw-r--r-- | drivers/gdisp/SSD1963/board_SSD1963_template.h | 4 | ||||
-rw-r--r-- | drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c | 25 | ||||
-rw-r--r-- | drivers/gdisp/SSD1963/ssd1963.h | 4 |
3 files changed, 23 insertions, 10 deletions
diff --git a/drivers/gdisp/SSD1963/board_SSD1963_template.h b/drivers/gdisp/SSD1963/board_SSD1963_template.h index f9f248e7..9f214604 100644 --- a/drivers/gdisp/SSD1963/board_SSD1963_template.h +++ b/drivers/gdisp/SSD1963/board_SSD1963_template.h @@ -16,7 +16,9 @@ static const LCD_Parameters DisplayTimings[] = { CALC_PERIOD(480,2,2,41), // Total Horizontal Period (calculated from above line) 2, 2, 10, // Vertical Timings (back porch, front porch, pulse) CALC_PERIOD(272,2,2,10), // Total Vertical Period (calculated from above line) - CALC_FPR(480,272,2,2,41,2,2,10,60ULL) // FPR - the 60ULL is the frames per second. Note the ULL! + CALC_FPR(480,272,2,2,41,2,2,10,60ULL), // FPR - the 60ULL is the frames per second. Note the ULL! + FALSE, // Flip horizontally + FALSE // Flip vertically }, }; diff --git a/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c b/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c index af2d907e..d3cd9d2a 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c +++ b/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c @@ -27,7 +27,7 @@ typedef struct LCD_Parameters { uint16_t vpulse; // Vertical Pulse uint16_t vperiod; // Vertical Period (Total) uint32_t fpr; // Calculated FPR - uint16_t flags; // For command "SSD1963_SET_GDISP_MODE" + uint16_t mode; // For command "SSD1963_SET_LCD_MODE" /* Set the pannel data width */ #define LCD_PANEL_DATA_WIDTH_24BIT (1<<5) // 18bit default /* Set the color deeph enhancement */ @@ -44,6 +44,9 @@ typedef struct LCD_Parameters { /* Set the lcd panel interface type */ // default TFT mode #define LCD_PANEL_TYPE_SERIAL_RGB_MODE ((1<<6) << 8) // Serial RGB mode #define LCD_PANEL_TYPE_SERIAL_RGB_DUMMY_MODE (((1<<5) | (1<<6)) << 8) // Serial RGB+dummy mode + + bool_t flipHorz; // Flipping the display horizontally + bool_t flipVert; // Flipping the display vertically } LCD_Parameters; #include "board_SSD1963.h" @@ -190,9 +193,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { write_reg(g, SSD1963_SET_PLL, 0x03); // Use PLL /* LCD panel parameters */ - write_index(g, SSD1963_SET_GDISP_MODE); - write_data(g, lcdp->flags & 0xFF); - write_data(g, (lcdp->flags >> 8) & 0xFF); + write_index(g, SSD1963_SET_LCD_MODE); + write_data(g, lcdp->mode & 0xFF); + write_data(g, (lcdp->mode >> 8) & 0xFF); //** write_data(g, 0x18); //Enabled dithering //** write_data(g, 0x00); write_data16(g, lcdp->width-1); @@ -200,9 +203,17 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { write_data(g, 0x00); // RGB - line sequences for serial TFT #endif - // From Displaytech example - for larger horizontal resolutions - not sure if display-specific - if (lcdp->width >= 640) - write_reg(g, SSD1963_SET_ADDRESS_MODE, 2); // Flip horizontal direction + + // Display flipping + if (lcdp->flipHorz) { + write_reg(g, SSD1963_SET_ADDRESS_MODE, SSD1963_ADDR_MODE_FLIP_HORZ); + } else if (lcdp->flipVert) { + write_reg(g, SSD1963_SET_ADDRESS_MODE, SSD1963_ADDR_MODE_FLIP_VERT); + } else if (lcdp->flipHorz && lcdp->flipVert) { + write_reg(g, SSD1963_SET_ADDRESS_MODE, SSD1963_ADDR_MODE_FLIP_VERT | SSD1963_ADDR_MODE_FLIP_HORZ); + } else { + write_reg(g, SSD1963_SET_ADDRESS_MODE, 0x00); + } write_reg(g, SSD1963_SET_PIXEL_DATA_INTERFACE, SSD1963_PDI_16BIT565); write_reg(g, SSD1963_SET_PIXEL_FORMAT, 0x50); diff --git a/drivers/gdisp/SSD1963/ssd1963.h b/drivers/gdisp/SSD1963/ssd1963.h index eec2ae99..c392b827 100644 --- a/drivers/gdisp/SSD1963/ssd1963.h +++ b/drivers/gdisp/SSD1963/ssd1963.h @@ -42,8 +42,8 @@ #define SSD1963_SET_TEAR_SCANLINE 0x0044 #define SSD1963_GET_SCANLINE 0x0045 #define SSD1963_READ_DDB 0x00A1 -#define SSD1963_SET_GDISP_MODE 0x00B0 -#define SSD1963_GET_GDISP_MODE 0x00B1 +#define SSD1963_SET_LCD_MODE 0x00B0 +#define SSD1963_GET_LCD_MODE 0x00B1 #define SSD1963_SET_HORI_PERIOD 0x00B4 #define SSD1963_GET_HORI_PERIOD 0x00B5 #define SSD1963_SET_VERT_PERIOD 0x00B6 |