From 1fcb2ba9c26ba2209f882309b5d8019cf3eb642c Mon Sep 17 00:00:00 2001 From: Tectu Date: Tue, 29 May 2012 02:10:11 +0200 Subject: [PATCH] added static heigh and width variables for supporting different modes --- glcd.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/glcd.c b/glcd.c index 5effa0eb..d62b54e0 100755 --- a/glcd.c +++ b/glcd.c @@ -3,7 +3,7 @@ #include static uint8_t orientation; -static uint16_t DeviceCode, temp; +static uint16_t DeviceCode, lcd_height, lcd_width; static __inline void lcdWriteIndex(uint16_t index) { Clr_RS; @@ -106,18 +106,26 @@ void lcdSetOrientation(uint8_t newOrientation) { case portrait: lcdWriteReg(0x0001, 0x2B3F); lcdWriteReg(0x0011, 0x6070); + lcd_height = SCREEN_HEIGHT; + lcd_width = SCREEN_WIDTH; break; case landscape: lcdWriteReg(0x0001, 0x293F); lcdWriteReg(0x0011, 0x6078); + lcd_height = SCREEN_WIDTH; + lcd_width = SCREEN_HEIGHT; break; case portraitInv: lcdWriteReg(0x0001, 0x693F); lcdWriteReg(0x0011, 0x6040); + lcd_height = SCREEN_HEIGHT; + lcd_width = SCREEN_WIDTH; break; case landscapeInv: lcdWriteReg(0x0001, 0x6B3F); lcdWriteReg(0x0011, 0x6048); + lcd_height = SCREEN_WIDTH; + lcd_width = SCREEN_HEIGHT; break; } } @@ -370,8 +378,8 @@ void lcdTest(void) { uint8_t y; uint8_t r,g,b; - for(y = 0; y < SCREEN_HEIGHT; y++) { - for(x = 0; x < SCREEN_WIDTH; x++) { + for(y = 0; y < lcd_height; y++) { + for(x = 0; x < lcd_width; x++) { r = x + y; g = x - y; b = y - x;