Skip to content

Commit

Permalink
st7789: add configuration option to set default background color
Browse files Browse the repository at this point in the history
ST7789 fills the display with 0xffff color during its initialization.
This color may or may not be overwritten by a higher layer (framebuffer
or lcd driver for example). The color remains on the display until
application UI is started if not overwritten by the higher layer before.

This commit adds configuration option LCD_ST7789_DEFAULT_COLOR that
allows to set the default background color. This may avoid shining
display with, for example, white color for an extensive amount of time.
The default value is set to 0xffff previously hard-coded in the driver,
therefore current implementations will not notice the change.

Signed-off-by: Michal Lenc <[email protected]>
  • Loading branch information
michallenc committed Nov 29, 2024
1 parent f589d5a commit e29a1bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions drivers/lcd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,15 @@ 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_DEFAULT_COLOR
hex "ST7789 Default Background Color"
default 0xffff
range 0 0xffff
---help---
This sets the default color of ST7789 display during its initialization.
It is the color that is filled to the display and remains there unless
higher layer (framebuffer/lcd) overwrites it.

config LCD_ST7789_BGR
bool "ST7789 Use BGR Instead Of RGB"
default n
Expand Down
2 changes: 1 addition & 1 deletion drivers/lcd/st7789.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi)
st7789_setorientation(priv);
#endif
st7789_display(priv, true);
st7789_fill(priv, 0xffff);
st7789_fill(priv, CONFIG_LCD_ST7789_DEFAULT_COLOR);

return &priv->dev;
}
Expand Down

0 comments on commit e29a1bb

Please sign in to comment.