Skip to content

Commit f3ea237

Browse files
Finomniscfriedt
authored andcommitted
tests: drivers: display: Add test cases for AL_88
Enable display_read_write test for AL_88 color and add support for AL_88 in display_check. Signed-off-by: Martin Stumpf <[email protected]>
1 parent b316dac commit f3ea237

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

tests/drivers/display/display_check/src/main.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,34 @@ static inline void fill_buffer_l_8(enum corner corner, uint8_t grey, uint8_t *bu
160160
}
161161
}
162162

163+
static void fill_buffer_al_88(enum corner corner, uint8_t grey, uint8_t *buf,
164+
size_t buf_size)
165+
{
166+
uint16_t color;
167+
168+
switch (corner) {
169+
case TOP_LEFT:
170+
color = 0xFF00u;
171+
break;
172+
case TOP_RIGHT:
173+
color = 0xFFFFu;
174+
break;
175+
case BOTTOM_RIGHT:
176+
color = 0xFF88u;
177+
break;
178+
case BOTTOM_LEFT:
179+
color = 0xFF00u | grey;
180+
break;
181+
default:
182+
color = 0;
183+
break;
184+
}
185+
186+
for (size_t idx = 0; idx < buf_size; idx += 2) {
187+
*((uint16_t *)(buf + idx)) = color;
188+
}
189+
}
190+
163191
static inline void fill_buffer_mono01(enum corner corner, uint8_t grey,
164192
uint8_t *buf, size_t buf_size)
165193
{
@@ -268,6 +296,11 @@ int test_display(void)
268296
bg_color = 0xFFu;
269297
fill_buffer_fnc = fill_buffer_l_8;
270298
break;
299+
case PIXEL_FORMAT_AL_88:
300+
bg_color = 0x00u;
301+
fill_buffer_fnc = fill_buffer_al_88;
302+
buf_size *= 2;
303+
break;
271304
case PIXEL_FORMAT_MONO01:
272305
bg_color = 0xFFu;
273306
fill_buffer_fnc = fill_buffer_mono01;

tests/drivers/display/display_read_write/src/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static inline uint8_t bytes_per_pixel(enum display_pixel_format pixel_format)
3434
return 3;
3535
case PIXEL_FORMAT_RGB_565:
3636
case PIXEL_FORMAT_BGR_565:
37+
case PIXEL_FORMAT_AL_88:
3738
return 2;
3839
case PIXEL_FORMAT_L_8:
3940
case PIXEL_FORMAT_MONO01:

tests/drivers/display/display_read_write/testcase.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ tests:
1515
- native_sim/native/64
1616
extra_configs:
1717
- CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_ARGB_8888=y
18+
drivers.display.read_write.sdl.al88:
19+
platform_allow:
20+
- native_sim
21+
- native_sim/native/64
22+
extra_configs:
23+
- CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_AL_88=y
1824
drivers.display.read_write.sdl.rgb888:
1925
platform_allow:
2026
- native_sim

0 commit comments

Comments
 (0)