Skip to content

Commit 3ea6e4e

Browse files
committed
kconfig: add color order selection for CUBE0414
1 parent 722b21a commit 3ea6e4e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

components/ugfx/drivers/gdisp/CUBE0414/gdisp_lld_CUBE0414.c

+12
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,15 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
122122
}
123123
LLDSPEC void gdisp_lld_write_color(GDisplay *g) {
124124
LLDCOLOR_TYPE c = gdispColor2Native(g->p.color);
125+
#ifdef CONFIG_CUBE0414_COLOR_GRB
125126
*((uint8_t *)g->priv + (stream_write_x + stream_write_y * g->g.Width) * 3 + 0) = c >> 8;
126127
*((uint8_t *)g->priv + (stream_write_x + stream_write_y * g->g.Width) * 3 + 1) = c >> 16;
127128
*((uint8_t *)g->priv + (stream_write_x + stream_write_y * g->g.Width) * 3 + 2) = c;
129+
#else
130+
*((uint8_t *)g->priv + (stream_write_x + stream_write_y * g->g.Width) * 3 + 0) = c >> 16;
131+
*((uint8_t *)g->priv + (stream_write_x + stream_write_y * g->g.Width) * 3 + 1) = c >> 8;
132+
*((uint8_t *)g->priv + (stream_write_x + stream_write_y * g->g.Width) * 3 + 2) = c;
133+
#endif
128134
stream_write_x++;
129135
if (--stream_write_cx <= 0) {
130136
stream_write_x = g->p.x;
@@ -157,9 +163,15 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
157163
stream_read_cy = g->p.cy;
158164
}
159165
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) {
166+
#ifdef CONFIG_CUBE0414_COLOR_GRB
160167
LLDCOLOR_TYPE c = (*((uint8_t *)g->priv + (stream_read_x + stream_read_y * g->g.Width) * 3 + 0) << 8)
161168
| (*((uint8_t *)g->priv + (stream_read_x + stream_read_y * g->g.Width) * 3 + 1) << 16)
162169
| (*((uint8_t *)g->priv + (stream_read_x + stream_read_y * g->g.Width) * 3 + 2));
170+
#else
171+
LLDCOLOR_TYPE c = (*((uint8_t *)g->priv + (stream_read_x + stream_read_y * g->g.Width) * 3 + 0) << 16)
172+
| (*((uint8_t *)g->priv + (stream_read_x + stream_read_y * g->g.Width) * 3 + 1) << 8)
173+
| (*((uint8_t *)g->priv + (stream_read_x + stream_read_y * g->g.Width) * 3 + 2));
174+
#endif
163175
stream_read_x++;
164176
if (--stream_read_cx <= 0) {
165177
stream_read_x = g->p.x;

main/Kconfig.projbuild

+13
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,19 @@ config CUBE0414_LINE_S_CURVE
223223
bool "S Curve"
224224
endchoice
225225

226+
choice CUBE0414_COLOR_ORDER
227+
prompt "CUBE0414 Color Order"
228+
default CUBE0414_COLOR_RGB
229+
depends on ENABLE_VFX && VFX_OUTPUT_CUBE0414
230+
help
231+
Select CUBE0414 color order.
232+
233+
config CUBE0414_COLOR_RGB
234+
bool "RGB"
235+
config CUBE0414_COLOR_GRB
236+
bool "GRB"
237+
endchoice
238+
226239
config DEVICE_RST_PIN
227240
int "Device RST Pin"
228241
default 14

0 commit comments

Comments
 (0)