Merge pull request #16479 from aabadie/pr/tests/disp_dev_enh
tests/disp_dev: improve genericity of application + optimize screen refresh
This commit is contained in:
commit
783db951f5
@ -3,7 +3,7 @@ include ../Makefile.tests_common
|
|||||||
|
|
||||||
DISABLE_MODULE += test_utils_interactive_sync
|
DISABLE_MODULE += test_utils_interactive_sync
|
||||||
|
|
||||||
USEMODULE += ili9341
|
USEMODULE += auto_init_screen
|
||||||
USEMODULE += disp_dev
|
USEMODULE += disp_dev
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|||||||
@ -22,40 +22,44 @@
|
|||||||
|
|
||||||
#include "disp_dev.h"
|
#include "disp_dev.h"
|
||||||
|
|
||||||
#include "ili9341.h"
|
|
||||||
#include "ili9341_params.h"
|
|
||||||
#include "ili9341_disp_dev.h"
|
|
||||||
|
|
||||||
#include "riot_logo.h"
|
#include "riot_logo.h"
|
||||||
|
|
||||||
#include "test_utils/expect.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)
|
int main(void)
|
||||||
{
|
{
|
||||||
ili9341_init(&ili9341, &ili9341_params[0]);
|
/* Use the first screen */
|
||||||
|
disp_dev_reg_t *disp_dev = disp_dev_reg_find_screen(0);
|
||||||
disp_dev_t *dev = (disp_dev_t *)&ili9341;
|
if (!disp_dev) {
|
||||||
dev->driver = &ili9341_disp_dev_driver;
|
puts("No screen found!");
|
||||||
|
return -1;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
puts("SUCCESS");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user