From 1ee47540d67648bc4f9f530c62bc96f29b53e2f6 Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Mon, 23 Jan 2012 23:38:16 +0100 Subject: [PATCH] Added SSD1331_COLORORDER_RGB/BGR flag --- drivers/lcd/tft/hw/ssd1331.c | 8 +++++++- drivers/lcd/tft/hw/ssd1331.h | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/lcd/tft/hw/ssd1331.c b/drivers/lcd/tft/hw/ssd1331.c index a5ac130..73b9654 100644 --- a/drivers/lcd/tft/hw/ssd1331.c +++ b/drivers/lcd/tft/hw/ssd1331.c @@ -236,7 +236,13 @@ void lcdInit(void) CMD(SSD1331_CMD_DISPLAYOFF); // 0xAE CMD(SSD1331_CMD_SETREMAP); // 0xA0 - CMD(0x76); // 0x74 + // A[2] = 1 = color order (0 = RGB, 1 = BGR) + // A[7:6] = 01 = 65K color + #if defined SSD1331_COLORORDER_BGR + CMD(0x76); + #else + CMD(0x72); + #endif CMD(SSD1331_CMD_STARTLINE); // 0xA1 CMD(0x0); CMD(SSD1331_CMD_DISPLAYOFFSET); // 0xA2 diff --git a/drivers/lcd/tft/hw/ssd1331.h b/drivers/lcd/tft/hw/ssd1331.h index bd98594..8b53927 100644 --- a/drivers/lcd/tft/hw/ssd1331.h +++ b/drivers/lcd/tft/hw/ssd1331.h @@ -41,6 +41,14 @@ #include "drivers/lcd/tft/lcd.h" #include "core/gpio/gpio.h" +// Select one of these defines to set the pixel color order +// #define SSD1331_COLORORDER_RGB +#define SSD1331_COLORORDER_BGR + +#if defined SSD1331_COLORORDER_RGB && defined SSD1331_COLORORDER_BGR + #error "RGB and BGR can not both be defined for SSD1331_COLORODER." +#endif + // Control pins #define SSD1331_SID_PORT 2 // DAT #define SSD1331_SID_PIN 1 -- 2.20.1