From ca03a9232767754d24bbf9c3203f6e56a20f9ea6 Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Wed, 20 Sep 2023 15:11:13 +0800 Subject: [PATCH] drivers/lcd/st7789: Add option to support set BGR mode --- drivers/lcd/Kconfig | 6 ++++++ drivers/lcd/st7789.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig index 66bd58ef86..667b571b6c 100644 --- a/drivers/lcd/Kconfig +++ b/drivers/lcd/Kconfig @@ -752,6 +752,12 @@ config LCD_ST7789_INVCOLOR Invert colors of the LCD display. This is useful for implementations that assume that that colors are inverted by default. +config LCD_ST7789_BGR + bool "ST7789 Use BGR Instead Of RGB" + default n + ---help--- + Use BGR color format instead of RGB color format. + config LCD_ST7789_BPP int "Bit Per Pixel (12 or 16)" default 16 diff --git a/drivers/lcd/st7789.c b/drivers/lcd/st7789.c index 1e92f82864..b6418fa5dd 100644 --- a/drivers/lcd/st7789.c +++ b/drivers/lcd/st7789.c @@ -480,6 +480,10 @@ static void st7789_setorientation(FAR struct st7789_dev_s *dev) madctl ^= 0x80; #endif +#ifdef CONFIG_LCD_ST7789_BGR + madctl |= 0x08; +#endif + SPI_SEND(dev->spi, LCD_ST7789_DATA_PREFIX | madctl); st7789_deselect(dev->spi);