ugfx_release_2.6
Tectu 2012-06-07 21:50:55 +02:00
parent e2aacd3744
commit 3367123b0b
1 changed files with 6 additions and 6 deletions

12
glcd.c
View File

@ -79,19 +79,19 @@ uint16_t lcdGetWidth(void) {
static void lcdSetCursor(uint16_t x, uint16_t y) { static void lcdSetCursor(uint16_t x, uint16_t y) {
if(DeviceCode==0x8989) { if(DeviceCode==0x8989) {
if(orientation == portrait || orientation == portraitInv) { if(PORTRAIT) {
lcdWriteReg(0x004e, x); lcdWriteReg(0x004e, x);
lcdWriteReg(0x004f, y); lcdWriteReg(0x004f, y);
} else if(orientation == landscape || orientation == landscapeInv) { } else if(LANDSCAPE) {
lcdWriteReg(0x004e, y); lcdWriteReg(0x004e, y);
lcdWriteReg(0x004f, x); lcdWriteReg(0x004f, x);
} }
} }
else if(DeviceCode==0x9919) { else if(DeviceCode==0x9919) {
if(orientation == portrait || orientation == portraitInv) { if(PORTRAIT) {
lcdWriteReg(0x004e, x); lcdWriteReg(0x004e, x);
lcdWriteReg(0x004f, y); lcdWriteReg(0x004f, y);
} else if(orientation == landscape || orientation == landscapeInv) { } else if(LANDSCAPE) {
lcdWriteReg(0x004e, y); lcdWriteReg(0x004e, y);
lcdWriteReg(0x004f, x); lcdWriteReg(0x004f, x);
} }
@ -146,14 +146,14 @@ uint16_t lcdGetOrientation(void) {
} }
void lcdSetWindow(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { void lcdSetWindow(uint16_t x, uint16_t y, uint16_t width, uint16_t height) {
if(orientation == portrait) { if(lcdGetOrientation() == portrait) {
lcdWriteReg(0x0050, x); /* Horizontal GRAM Start Address */ lcdWriteReg(0x0050, x); /* Horizontal GRAM Start Address */
lcdWriteReg(0x0051, x+width-1); /* Horizontal GRAM End Address (-1) */ lcdWriteReg(0x0051, x+width-1); /* Horizontal GRAM End Address (-1) */
lcdWriteReg(0x0052, y); /* Vertical GRAM Start Address */ lcdWriteReg(0x0052, y); /* Vertical GRAM Start Address */
lcdWriteReg(0x0053, y+height-1); /* Vertical GRAM End Address (-1) */ lcdWriteReg(0x0053, y+height-1); /* Vertical GRAM End Address (-1) */
lcdWriteReg(0x0020, x); lcdWriteReg(0x0020, x);
lcdWriteReg(0x0021, y); lcdWriteReg(0x0021, y);
} else if(orientation == landscape) { } else if(lcdGetOrientation() == landscape) {
lcdWriteReg(0x0050, y); /* Vertical GRAM Start Address */ lcdWriteReg(0x0050, y); /* Vertical GRAM Start Address */
lcdWriteReg(0x0051, y+height-1); /* Vertical GRAM End Address (-1) */ lcdWriteReg(0x0051, y+height-1); /* Vertical GRAM End Address (-1) */
lcdWriteReg(0x0052, x); /* Horizontal GRAM Start Address */ lcdWriteReg(0x0052, x); /* Horizontal GRAM Start Address */