This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new a8d4ed910d st7789: add configuration option to set default background 
color
a8d4ed910d is described below

commit a8d4ed910d035b9cbe59fe6f21bcf2e1dcbf4284
Author: Michal Lenc <[email protected]>
AuthorDate: Fri Nov 29 09:45:33 2024 +0100

    st7789: add configuration option to set default background color
    
    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]>
---
 drivers/lcd/Kconfig  | 9 +++++++++
 drivers/lcd/st7789.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig
index d3b54b4dda..c4401c4ce2 100644
--- a/drivers/lcd/Kconfig
+++ b/drivers/lcd/Kconfig
@@ -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
diff --git a/drivers/lcd/st7789.c b/drivers/lcd/st7789.c
index 59adb8195a..e69fb0e2cf 100644
--- a/drivers/lcd/st7789.c
+++ b/drivers/lcd/st7789.c
@@ -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;
 }

Reply via email to