added static heigh and width variables for supporting different modes
This commit is contained in:
parent
d482576656
commit
1fcb2ba9c2
14
glcd.c
14
glcd.c
@ -3,7 +3,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
static uint8_t orientation;
|
static uint8_t orientation;
|
||||||
static uint16_t DeviceCode, temp;
|
static uint16_t DeviceCode, lcd_height, lcd_width;
|
||||||
|
|
||||||
static __inline void lcdWriteIndex(uint16_t index) {
|
static __inline void lcdWriteIndex(uint16_t index) {
|
||||||
Clr_RS;
|
Clr_RS;
|
||||||
@ -106,18 +106,26 @@ void lcdSetOrientation(uint8_t newOrientation) {
|
|||||||
case portrait:
|
case portrait:
|
||||||
lcdWriteReg(0x0001, 0x2B3F);
|
lcdWriteReg(0x0001, 0x2B3F);
|
||||||
lcdWriteReg(0x0011, 0x6070);
|
lcdWriteReg(0x0011, 0x6070);
|
||||||
|
lcd_height = SCREEN_HEIGHT;
|
||||||
|
lcd_width = SCREEN_WIDTH;
|
||||||
break;
|
break;
|
||||||
case landscape:
|
case landscape:
|
||||||
lcdWriteReg(0x0001, 0x293F);
|
lcdWriteReg(0x0001, 0x293F);
|
||||||
lcdWriteReg(0x0011, 0x6078);
|
lcdWriteReg(0x0011, 0x6078);
|
||||||
|
lcd_height = SCREEN_WIDTH;
|
||||||
|
lcd_width = SCREEN_HEIGHT;
|
||||||
break;
|
break;
|
||||||
case portraitInv:
|
case portraitInv:
|
||||||
lcdWriteReg(0x0001, 0x693F);
|
lcdWriteReg(0x0001, 0x693F);
|
||||||
lcdWriteReg(0x0011, 0x6040);
|
lcdWriteReg(0x0011, 0x6040);
|
||||||
|
lcd_height = SCREEN_HEIGHT;
|
||||||
|
lcd_width = SCREEN_WIDTH;
|
||||||
break;
|
break;
|
||||||
case landscapeInv:
|
case landscapeInv:
|
||||||
lcdWriteReg(0x0001, 0x6B3F);
|
lcdWriteReg(0x0001, 0x6B3F);
|
||||||
lcdWriteReg(0x0011, 0x6048);
|
lcdWriteReg(0x0011, 0x6048);
|
||||||
|
lcd_height = SCREEN_WIDTH;
|
||||||
|
lcd_width = SCREEN_HEIGHT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,8 +378,8 @@ void lcdTest(void) {
|
|||||||
uint8_t y;
|
uint8_t y;
|
||||||
uint8_t r,g,b;
|
uint8_t r,g,b;
|
||||||
|
|
||||||
for(y = 0; y < SCREEN_HEIGHT; y++) {
|
for(y = 0; y < lcd_height; y++) {
|
||||||
for(x = 0; x < SCREEN_WIDTH; x++) {
|
for(x = 0; x < lcd_width; x++) {
|
||||||
r = x + y;
|
r = x + y;
|
||||||
g = x - y;
|
g = x - y;
|
||||||
b = y - x;
|
b = y - x;
|
||||||
|
Loading…
Reference in New Issue
Block a user