Skip to content

Commit

Permalink
tests/drivers/st77xx: add benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Oct 5, 2023
1 parent c21f7de commit 23bea86
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions tests/drivers/st77xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endif
DRIVER ?= st7735

USEMODULE += $(DRIVER)
USEMODULE += benchmark
USEMODULE += ztimer
USEMODULE += ztimer_msec

Expand Down
1 change: 1 addition & 0 deletions tests/drivers/st77xx/app.config.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_BENCHMARK=y
CONFIG_MODULE_ST77XX=y
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_MSEC=y
16 changes: 12 additions & 4 deletions tests/drivers/st77xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <stdio.h>
#include "timex.h"
#include "ztimer.h"
#include "benchmark.h"
#include "board.h"
#include "lcd.h"
#include "lcd_internal.h"
Expand Down Expand Up @@ -92,14 +93,21 @@ int main(void)
lcd_invert_off(&dev);
puts("lcd TFT display normal");

puts("lcd TFT display clear screen");
lcd_fill(&dev, 0, dev.params->lines, 0, dev.params->rgb_channels, 0x0000);
puts("lcd TFT display clear screen with benchmarking");
BENCHMARK_FUNC("fill", 1,
lcd_fill(&dev, 0, dev.params->lines, 0, dev.params->rgb_channels, 0x0000));

#ifndef CONFIG_NO_RIOT_IMAGE
printf("Write pixmap of size %u x %u with benchmarking\n",
RIOT_LOGO_WIDTH, RIOT_LOGO_HEIGHT);
/* Approximate middle of the display */
uint8_t x1 = (dev.params->lines / 2) - (RIOT_LOGO_WIDTH / 2);
uint8_t y1 = (dev.params->rgb_channels / 2) - (RIOT_LOGO_HEIGHT / 2);
lcd_pixmap(&dev, x1, x1 + RIOT_LOGO_WIDTH - 1, y1, y1 + RIOT_LOGO_HEIGHT - 1,
(const uint16_t *)picture);
BENCHMARK_FUNC("fill", 1,
lcd_pixmap(&dev,
x1, x1 + RIOT_LOGO_WIDTH - 1,
y1, y1 + RIOT_LOGO_HEIGHT - 1,
(const uint16_t *)picture));
#endif
while (1) {}

Expand Down

0 comments on commit 23bea86

Please sign in to comment.