diff options
author | Andreas Regel <andreas.regel@gmx.de> | 2015-04-20 20:50:53 +0200 |
---|---|---|
committer | Andreas Regel <andreas.regel@gmx.de> | 2016-04-01 23:44:14 +0200 |
commit | 8f11eccf720cdfc4638f4fee4c5a423a30ac4807 (patch) | |
tree | 103f9d3f4a1978be67145c265b9c3c97e0140364 | |
parent | ebc6ce5f34462c3c5b3a13901f7e5449abef1968 (diff) | |
download | graphlcd-base-8f11eccf720cdfc4638f4fee4c5a423a30ac4807.tar.gz graphlcd-base-8f11eccf720cdfc4638f4fee4c5a423a30ac4807.tar.bz2 |
ili9431: Rotate display by 90 degrees.
-rw-r--r-- | glcddrivers/ili9341.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/glcddrivers/ili9341.c b/glcddrivers/ili9341.c index eb3a819..bbea783 100644 --- a/glcddrivers/ili9341.c +++ b/glcddrivers/ili9341.c @@ -25,8 +25,8 @@ namespace GLCD { -const int kLcdWidth = 240; -const int kLcdHeight = 320; +const int kLcdWidth = 320; +const int kLcdHeight = 240; const int kSpiBus = 0; @@ -290,22 +290,22 @@ void cDriverILI9341::Refresh(bool refreshAll) refreshAll = true; if (refreshAll) { - SetWindow(0, 0, width - 1, height - 1); + SetWindow(0, 0, height - 1, width - 1); WriteCommand(kCmdMemoryWrite); - for (y = 0; y < height; y++) + for (y = 0; y < width; y++) { - uint8_t line[width * 2]; - uint32_t * pixel = &newLCD[y * width]; + uint8_t line[height * 2]; + uint32_t * pixel = &newLCD[width - 1 - y]; - for (int x = 0; x < (width * 2); x += 2) + for (int x = 0; x < (height * 2); x += 2) { line[x] = ((*pixel & 0x00F80000) >> 16) | ((*pixel & 0x0000E000) >> 13); line[x + 1] = ((*pixel & 0x00001C00) >> 5) | ((*pixel & 0x000000F8) >> 3); - pixel++; + pixel += width; } - WriteData((uint8_t *) line, width * 2); + WriteData((uint8_t *) line, height * 2); } memcpy(oldLCD, newLCD, width * height * sizeof(uint32_t)); // and reset RefreshCounter |