Skip to content

Commit a8ecd94

Browse files
danieldegrassefabiobaltieri
authored andcommitted
drivers: display: display_st7796s: update for RGB format change
Zephyr is swapping the definitions of RGB565 and BGR565. Swap the return values provided by this driver for supported pixel formats to account for this. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent a6602a4 commit a8ecd94

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/display/display_st7796s.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ static int st7796s_get_pixelfmt(const struct device *dev)
102102
/*
103103
* Invert the pixel format for 8-bit 8080 Parallel Interface.
104104
*
105-
* Zephyr uses big endian byte order when the pixel format has
105+
* Zephyr uses little endian byte order when the pixel format has
106106
* multiple bytes.
107107
*
108-
* For RGB565, Red is placed in byte 1 and Blue in byte 0.
109-
* For BGR565, Red is placed in byte 0 and Blue in byte 1.
108+
* For BGR565, Red is placed in byte 1 and Blue in byte 0.
109+
* For RGB565, Red is placed in byte 0 and Blue in byte 1.
110110
*
111111
* This is not an issue when using a 16-bit interface.
112112
* For RGB565, this would map to Red being in D[11:15] and
113113
* Blue in D[0:4] and vice versa for BGR565.
114114
*
115115
* However this is an issue when using a 8-bit interface.
116-
* For RGB565, Blue is placed in byte 0 as mentioned earlier.
116+
* For BGR565, Blue is placed in byte 0 as mentioned earlier.
117117
* However the controller expects Red to be in D[3:7] of byte 0.
118118
*
119119
* Hence we report pixel format as RGB when MADCTL setting is BGR
@@ -143,9 +143,9 @@ static int st7796s_get_pixelfmt(const struct device *dev)
143143
*/
144144
if (((bool)(config->madctl & ST7796S_MADCTL_BGR)) !=
145145
config->rgb_is_inverted) {
146-
return PIXEL_FORMAT_BGR_565;
147-
} else {
148146
return PIXEL_FORMAT_RGB_565;
147+
} else {
148+
return PIXEL_FORMAT_BGR_565;
149149
}
150150
}
151151

0 commit comments

Comments
 (0)