Forked para SNOCC
Fork of RA8875 by
Diff: RA8875.cpp
- Revision:
- 90:d113d71ae4f0
- Parent:
- 89:04575562c961
- Child:
- 91:ca5f829e6d27
--- a/RA8875.cpp Sun Jan 25 00:15:02 2015 +0000 +++ b/RA8875.cpp Wed Jan 28 12:21:11 2015 +0000 @@ -125,6 +125,7 @@ wait_ms(1); // Horizontal Settings + screenwidth = width; WriteCommand(0x14, width/8 - 1); //HDWR//Horizontal Display Width Setting Bit[6:0] WriteCommand(0x15, 0x02); //HNDFCR//Horizontal Non-Display Period fine tune Bit[3:0] WriteCommand(0x16, 0x03); //HNDR//Horizontal Non-Display Period Bit[4:0] @@ -132,6 +133,7 @@ WriteCommand(0x18, 0x03); //HPWR//HSYNC Polarity ,The period width of HSYNC. // Vertical Settings + screenheight = height; WriteCommand(0x19, (height-1)&0xFF); //VDHR0 //Vertical Display Height Bit [7:0] WriteCommand(0x1a, (height-1)>>8); //VDHR1 //Vertical Display Height Bit [8] WriteCommand(0x1b, 0x0F); //VNDR0 //Vertical Non-Display Period Bit [7:0] @@ -575,13 +577,21 @@ dim_t RA8875::width(void) { - return (ReadCommand(0x14) + 1) * 8; + if (portraitmode) + return screenheight; + else + return screenwidth; +// return (ReadCommand(0x14) + 1) * 8; } dim_t RA8875::height(void) { - return (ReadCommand(0x19) | (ReadCommand(0x1A) << 8)) + 1; + if (portraitmode) + return screenwidth; + else + return screenheight; +// return (ReadCommand(0x19) | (ReadCommand(0x1A) << 8)) + 1; } @@ -682,18 +692,22 @@ case RA8875::normal: //fncr1Val |= 0x10; //dpcrVal |= 0x00; + portraitmode = false; break; case RA8875::rotate_90: fncr1Val |= 0x10; dpcrVal |= 0x08; + portraitmode = true; break; case RA8875::rotate_180: //fncr1Val |= 0x00; dpcrVal |= 0x0C; + portraitmode = false; break; case RA8875::rotate_270: fncr1Val |= 0x10; dpcrVal |= 0x04; + portraitmode = true; break; default: return bad_parameter;