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
commit 3a4b53b37c12e22447adcf7d570230c9570389d5 Author: Jiri Vlasak <[email protected]> AuthorDate: Fri Nov 7 13:58:57 2025 +0100 lcd/ili9341: Add config option for BGR Display's BGR mode should not depend on the endianness. Signed-off-by: Jiri Vlasak <[email protected]> --- drivers/lcd/Kconfig | 7 +++++++ drivers/lcd/ili9341.c | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/lcd/Kconfig b/drivers/lcd/Kconfig index be32c7946e9..7ff1feb1398 100644 --- a/drivers/lcd/Kconfig +++ b/drivers/lcd/Kconfig @@ -1434,6 +1434,13 @@ config LCD_ILI9341 LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted. LCD_MAXPOWER should be 1: 0=off, 1=on +config LCD_ILI9341_BGR + bool "Use BGR order for RGB colors." + default n + depends on LCD_ILI9341 + ---help--- + Use BGR color order instead of RGB (Memory Access Control). + config LCD_ILI9341_NINTERFACES int "Number of supported display driver" range 1 2 diff --git a/drivers/lcd/ili9341.c b/drivers/lcd/ili9341.c index dee4ce7542d..16fd97e1902 100644 --- a/drivers/lcd/ili9341.c +++ b/drivers/lcd/ili9341.c @@ -148,7 +148,7 @@ * MX: 0 * MV: 1 * ML: 0 - * BGR: 0/1 Depending on endian mode of the mcu? + * BGR: 0/1 * MH: 0 */ @@ -156,10 +156,10 @@ #define ILI9341_MADCTL_LANDSCAPE_MX 0 #define ILI9341_MADCTL_LANDSCAPE_MV ILI9341_MEMORY_ACCESS_CONTROL_MV #define ILI9341_MADCTL_LANDSCAPE_ML 0 -#ifdef CONFIG_ENDIAN_BIG -# define ILI9341_MADCTL_LANDSCAPE_BGR 0 -#else +#ifdef CONFIG_ILI9341_BGR # define ILI9341_MADCTL_LANDSCAPE_BGR ILI9341_MEMORY_ACCESS_CONTROL_BGR +#else +# define ILI9341_MADCTL_LANDSCAPE_BGR 0 #endif #define ILI9341_MADCTL_LANDSCAPE_MH 0 @@ -176,7 +176,7 @@ * MX: 0 * MV: 0 * ML: 0 - * BGR: 0/1 Depending on endian mode of the mcu? + * BGR: 0/1 * MH: 0 */ @@ -184,10 +184,10 @@ #define ILI9341_MADCTL_PORTRAIT_MX ILI9341_MEMORY_ACCESS_CONTROL_MX #define ILI9341_MADCTL_PORTRAIT_MV 0 #define ILI9341_MADCTL_PORTRAIT_ML ILI9341_MEMORY_ACCESS_CONTROL_ML -#ifdef CONFIG_ENDIAN_BIG -# define ILI9341_MADCTL_PORTRAIT_BGR 0 -#else +#ifdef CONFIG_ILI9341_BGR # define ILI9341_MADCTL_PORTRAIT_BGR ILI9341_MEMORY_ACCESS_CONTROL_BGR +#else +# define ILI9341_MADCTL_PORTRAIT_BGR 0 #endif #define ILI9341_MADCTL_PORTRAIT_MH 0 @@ -203,7 +203,7 @@ * MX: 1 * MV: 1 * ML: 0 - * BGR: 0/1 Depending on endian mode of the mcu? + * BGR: 0/1 * MH: 0 */ @@ -211,10 +211,10 @@ #define ILI9341_MADCTL_RLANDSCAPE_MX ILI9341_MEMORY_ACCESS_CONTROL_MX #define ILI9341_MADCTL_RLANDSCAPE_MV ILI9341_MEMORY_ACCESS_CONTROL_MV #define ILI9341_MADCTL_RLANDSCAPE_ML 0 -#ifdef CONFIG_ENDIAN_BIG -# define ILI9341_MADCTL_RLANDSCAPE_BGR 0 -#else +#ifdef CONFIG_ILI9341_BGR # define ILI9341_MADCTL_RLANDSCAPE_BGR ILI9341_MEMORY_ACCESS_CONTROL_BGR +#else +# define ILI9341_MADCTL_RLANDSCAPE_BGR 0 #endif #define ILI9341_MADCTL_RLANDSCAPE_MH 0 @@ -232,7 +232,7 @@ * MX: 1 * MV: 0 * ML: 0 - * BGR: 0/1 Depending on endian mode of the mcu? + * BGR: 0/1 * MH: 0 * */ @@ -241,10 +241,10 @@ #define ILI9341_MADCTL_RPORTRAIT_MX 0 #define ILI9341_MADCTL_RPORTRAIT_MV 0 #define ILI9341_MADCTL_RPORTRAIT_ML ILI9341_MEMORY_ACCESS_CONTROL_ML -#ifdef CONFIG_ENDIAN_BIG -# define ILI9341_MADCTL_RPORTRAIT_BGR 0 -#else +#ifdef CONFIG_ILI9341_BGR # define ILI9341_MADCTL_RPORTRAIT_BGR ILI9341_MEMORY_ACCESS_CONTROL_BGR +#else +# define ILI9341_MADCTL_RPORTRAIT_BGR 0 #endif #define ILI9341_MADCTL_RPORTRAIT_MH 0
