From 7e9868616cd51ba0acf5a28eeda017d42c0179da Mon Sep 17 00:00:00 2001 From: Tectu Date: Fri, 1 Jun 2012 11:49:56 +0200 Subject: [PATCH] added lcdGetOrientation --- glcd.c | 4 ++++ glcd.h | 1 + touchpad.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/glcd.c b/glcd.c index bd9b269b..acf779df 100644 --- a/glcd.c +++ b/glcd.c @@ -146,6 +146,10 @@ void lcdSetOrientation(uint8_t newOrientation) { } } +uint16_t lcdGetOrientation(void) { + return orientation; +} + void lcdSetWindow(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { if(orientation == portrait) { lcdWriteReg(0x0050, x); /* Horizontal GRAM Start Address */ diff --git a/glcd.h b/glcd.h index 2af3ddf0..6ad127fa 100644 --- a/glcd.h +++ b/glcd.h @@ -62,6 +62,7 @@ void lcdDrawString(uint16_t x, uint16_t y, uint8_t *str,uint16_t color, uint16_t void lcdDrawChar(uint16_t x, uint16_t y, unsigned char c, uint16_t charcolor, uint16_t bkColor); uint16_t lcdGetHeight(void); uint16_t lcdGetWidth(void); +uint16_t lcdGetOrientation(void); uint16_t lcdBGR2RGB(uint16_t color); uint16_t lcdGetPixelColor(uint16_t x, uint16_t y); diff --git a/touchpad.c b/touchpad.c index d34ea308..b7d722cc 100644 --- a/touchpad.c +++ b/touchpad.c @@ -29,7 +29,16 @@ uint16_t tpReadX(void) { x = (((lcdGetWidth()-1) * x)/2048); - return x; + switch(lcdGetOrientation()) { + case portrait: + break; + case portraitInv: + break; + case landscape: + break; + case landscapeInv: + break; + } } uint16_t tpReadY(void) {