diff options
author | Kumar Abhishek <abhishek.kakkar@hotmail.com> | 2012-10-06 00:38:34 +0530 |
---|---|---|
committer | Kumar Abhishek <abhishek.kakkar@hotmail.com> | 2012-10-06 00:38:34 +0530 |
commit | e74e2e1e3280d026e6ee760e6c396499a14edfd6 (patch) | |
tree | 09e791c8bba117e1d95d1dd218a2278510783bb4 /drivers | |
parent | 2f22de29f6d3720a95b0017bc987749034540fe4 (diff) | |
download | uGFX-e74e2e1e3280d026e6ee760e6c396499a14edfd6.tar.gz uGFX-e74e2e1e3280d026e6ee760e6c396499a14edfd6.tar.bz2 uGFX-e74e2e1e3280d026e6ee760e6c396499a14edfd6.zip |
S6D1121 Orientation-related fixes
S6D1121 set cursor and set viewPort functions validated.
GPIO interface readback shall be included in the next commit.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gdisp/S6D1121/s6d1121_lld.c.h | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/gdisp/S6D1121/s6d1121_lld.c.h b/drivers/gdisp/S6D1121/s6d1121_lld.c.h index e5d8c76b..76a64ce3 100644 --- a/drivers/gdisp/S6D1121/s6d1121_lld.c.h +++ b/drivers/gdisp/S6D1121/s6d1121_lld.c.h @@ -182,21 +182,22 @@ static void lld_lcdSetCursor(coord_t x, coord_t y) { * R21h - 9 bit
*/
switch(GDISP.Orientation) {
- case GDISP_ROTATE_180:
- lld_lcdWriteReg(0x0020, (SCREEN_WIDTH-1-x) & 0x00FF);
- lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT-1-y) & 0x01FF);
- break;
case GDISP_ROTATE_0:
lld_lcdWriteReg(0x0020, x & 0x00FF);
lld_lcdWriteReg(0x0021, y & 0x01FF);
break;
case GDISP_ROTATE_90:
+ /* Note X has already been mirrored, so we do it directly */
lld_lcdWriteReg(0x0020, y & 0x00FF);
lld_lcdWriteReg(0x0021, x & 0x01FF);
break;
+ case GDISP_ROTATE_180:
+ lld_lcdWriteReg(0x0020, (SCREEN_WIDTH - 1 - x) & 0x00FF);
+ lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT - 1 - y) & 0x01FF);
+ break;
case GDISP_ROTATE_270:
- lld_lcdWriteReg(0x0020, (SCREEN_WIDTH - y - 1) & 0x00FF);
- lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT - x - 1) & 0x01FF);
+ lld_lcdWriteReg(0x0020, (SCREEN_WIDTH - 1 - y) & 0x00FF);
+ lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT - 1 - x) & 0x01FF);
break;
}
}
@@ -209,23 +210,29 @@ static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) switch(GDISP.Orientation) {
case GDISP_ROTATE_0:
- lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF));
+ lld_lcdWriteReg(0x46, (((x + cx - 1) << 8) & 0xFF00 ) |
+ (x & 0x00FF));
+
lld_lcdWriteReg(0x48, y & 0x01FF);
- lld_lcdWriteReg(0x47, (y+cy-1) & 0x01FF);
+ lld_lcdWriteReg(0x47, (y + cy - 1) & 0x01FF);
break;
case GDISP_ROTATE_90:
- lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00) | ((y+cy) & 0x00FF));
+ lld_lcdWriteReg(0x46, (((y + cy - 1) << 8) & 0xFF00) |
+ (y & 0x00FF));
+
lld_lcdWriteReg(0x48, x & 0x01FF);
- lld_lcdWriteReg(0x47, (x+cx-1) & 0x01FF);
+ lld_lcdWriteReg(0x47, (x + cx - 1) & 0x01FF);
break;
case GDISP_ROTATE_180:
- lld_lcdWriteReg(0x46, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF));
- lld_lcdWriteReg(0x48, (SCREEN_HEIGHT-(y+cy)) & 0x01FF);
- lld_lcdWriteReg(0x47, (SCREEN_HEIGHT-y-1) & 0x01FF);
+ lld_lcdWriteReg(0x46, (((SCREEN_WIDTH - x - 1) & 0x00FF) << 8) |
+ ((SCREEN_WIDTH - (x + cx)) & 0x00FF));
+ lld_lcdWriteReg(0x48, (SCREEN_HEIGHT - (y + cy)) & 0x01FF);
+ lld_lcdWriteReg(0x47, (SCREEN_HEIGHT- y - 1) & 0x01FF);
break;
case GDISP_ROTATE_270:
- lld_lcdWriteReg(0x46, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF));
- lld_lcdWriteReg(0x48, (SCREEN_HEIGHT - (x+cx)) & 0x01FF);
+ lld_lcdWriteReg(0x46, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) |
+ ((SCREEN_WIDTH - (y + cy)) & 0x00FF));
+ lld_lcdWriteReg(0x48, (SCREEN_HEIGHT - (x + cx)) & 0x01FF);
lld_lcdWriteReg(0x47, (SCREEN_HEIGHT - x - 1) & 0x01FF);
break;
}
|