diff --git a/tests/disp_dev/Makefile b/tests/disp_dev/Makefile index 94579d55a2..8c571927ad 100644 --- a/tests/disp_dev/Makefile +++ b/tests/disp_dev/Makefile @@ -3,7 +3,7 @@ include ../Makefile.tests_common DISABLE_MODULE += test_utils_interactive_sync -USEMODULE += ili9341 +USEMODULE += auto_init_screen USEMODULE += disp_dev include $(RIOTBASE)/Makefile.include diff --git a/tests/disp_dev/main.c b/tests/disp_dev/main.c index e658128905..de40b10098 100644 --- a/tests/disp_dev/main.c +++ b/tests/disp_dev/main.c @@ -22,40 +22,44 @@ #include "disp_dev.h" -#include "ili9341.h" -#include "ili9341_params.h" -#include "ili9341_disp_dev.h" - #include "riot_logo.h" #include "test_utils/expect.h" -static ili9341_t ili9341; +#if IS_USED(MODULE_ILI9341) +#include "ili9341.h" +#endif + +#define DISPLAY_BUFFER_MAX_SIZE (320) +static uint16_t display_buffer[DISPLAY_BUFFER_MAX_SIZE] = { 0 }; int main(void) { - ili9341_init(&ili9341, &ili9341_params[0]); - - disp_dev_t *dev = (disp_dev_t *)&ili9341; - dev->driver = &ili9341_disp_dev_driver; - - disp_dev_set_invert(dev, true); - disp_dev_backlight_on(); - - uint16_t max_width = disp_dev_width(dev); - uint16_t max_height = disp_dev_height(dev); - - expect(max_width == ili9341.params->lines); - expect(max_height == 240); - - uint16_t color = 0; - for (uint16_t y = 0; y < max_height; ++y) { - for (uint16_t x = 0; x < max_width; ++x) { - disp_dev_map(dev, x, x, y, y, &color); - } + /* Use the first screen */ + disp_dev_reg_t *disp_dev = disp_dev_reg_find_screen(0); + if (!disp_dev) { + puts("No screen found!"); + return -1; } - disp_dev_map(dev, 95, 222, 85, 153, (const uint16_t *)picture); + disp_dev_set_invert(disp_dev->dev, true); + disp_dev_backlight_on(); + + uint16_t max_width = disp_dev_width(disp_dev->dev); + uint16_t max_height = disp_dev_height(disp_dev->dev); + +#if IS_USED(MODULE_ILI9341) + ili9341_t *ili9341 = (ili9341_t *)disp_dev->dev; + expect(ili9341); + expect(max_width == ili9341->params->lines); + expect(max_height == 240); +#endif + + for (uint16_t y = 0; y < max_height; ++y) { + disp_dev_map(disp_dev->dev, 0, max_width - 1, y, y, display_buffer); + } + + disp_dev_map(disp_dev->dev, 95, 222, 85, 153, (const uint16_t *)picture); puts("SUCCESS");