drivers/lcd/st7789: Add option to support set BGR mode

This commit is contained in:
Dong Heng
2023-09-20 15:11:13 +08:00
committed by Xiang Xiao
parent 203b558ec9
commit ca03a92327
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -752,6 +752,12 @@ config LCD_ST7789_INVCOLOR
Invert colors of the LCD display. This is useful for implementations Invert colors of the LCD display. This is useful for implementations
that assume that that colors are inverted by default. 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 config LCD_ST7789_BPP
int "Bit Per Pixel (12 or 16)" int "Bit Per Pixel (12 or 16)"
default 16 default 16
+4
View File
@@ -480,6 +480,10 @@ static void st7789_setorientation(FAR struct st7789_dev_s *dev)
madctl ^= 0x80; madctl ^= 0x80;
#endif #endif
#ifdef CONFIG_LCD_ST7789_BGR
madctl |= 0x08;
#endif
SPI_SEND(dev->spi, LCD_ST7789_DATA_PREFIX | madctl); SPI_SEND(dev->spi, LCD_ST7789_DATA_PREFIX | madctl);
st7789_deselect(dev->spi); st7789_deselect(dev->spi);