From 94fdead6411c3b5ed59786d58878246b02a1e130 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 30 Jul 2023 09:43:10 +0200 Subject: [PATCH 1/4] cpu/stm32: add FMC support for LCD with parallel interface --- cpu/stm32/Kconfig | 1 + cpu/stm32/Makefile | 4 + cpu/stm32/Makefile.dep | 4 + cpu/stm32/include/lcd_fmc.h | 60 ++++++++++ cpu/stm32/include/periph/cpu_fmc.h | 11 ++ cpu/stm32/lcd_fmc/Kconfig | 13 +++ cpu/stm32/lcd_fmc/Makefile | 3 + cpu/stm32/lcd_fmc/lcd_fmc.c | 176 +++++++++++++++++++++++++++++ 8 files changed, 272 insertions(+) create mode 100644 cpu/stm32/include/lcd_fmc.h create mode 100644 cpu/stm32/lcd_fmc/Kconfig create mode 100644 cpu/stm32/lcd_fmc/Makefile create mode 100644 cpu/stm32/lcd_fmc/lcd_fmc.c diff --git a/cpu/stm32/Kconfig b/cpu/stm32/Kconfig index 1641e79bc54e6..e714eca3c3787 100644 --- a/cpu/stm32/Kconfig +++ b/cpu/stm32/Kconfig @@ -78,6 +78,7 @@ rsource "periph/Kconfig.fmc" if TEST_KCONFIG +rsource "lcd_fmc/Kconfig" rsource "periph/Kconfig" rsource "stmclk/Kconfig" rsource "vectors/Kconfig" diff --git a/cpu/stm32/Makefile b/cpu/stm32/Makefile index 5a56d50d65ff9..b7de58ef40919 100644 --- a/cpu/stm32/Makefile +++ b/cpu/stm32/Makefile @@ -6,4 +6,8 @@ ifneq (,$(filter bootloader_stm32,$(USEMODULE))) DIRS += bootloader endif +ifneq (,$(filter lcd_fmc,$(USEMODULE))) + DIRS += lcd_fmc +endif + include $(RIOTBASE)/Makefile.base diff --git a/cpu/stm32/Makefile.dep b/cpu/stm32/Makefile.dep index 2b85221dc165c..b1aca8e5be9a9 100644 --- a/cpu/stm32/Makefile.dep +++ b/cpu/stm32/Makefile.dep @@ -54,6 +54,10 @@ ifneq (,$(filter stm32_eth,$(USEMODULE))) endif endif +ifneq (,$(filter lcd_parallel_ll_mcu,$(USEMODULE))) + USEMODULE += lcd_fmc +endif + ifneq (,$(filter periph_can,$(FEATURES_USED))) FEATURES_REQUIRED += periph_gpio FEATURES_REQUIRED += periph_gpio_irq diff --git a/cpu/stm32/include/lcd_fmc.h b/cpu/stm32/include/lcd_fmc.h new file mode 100644 index 0000000000000..c95b95126f1cd --- /dev/null +++ b/cpu/stm32/include/lcd_fmc.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2023 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @defgroup cpu_stm32_lcd_fmc STM32 FMC/FSMC LCD low-level parallel interface driver + * @ingroup cpu_stm32 + * + * @{ + */ + +#ifndef LCD_FMC_H +#define LCD_FMC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Number of LCDs using FMC banks + * + * It represents the number of elements in LCD FMC bank descriptor array of + * type @ref lcd_fmc_desc_t. Because it is used by the preprocessor, it has + * to be defined as a number. It is not possible to use the @ref ARRAY_SIZE + * macro here. + * + * @note `LCD_FMC_NUMOF` has to be equal to the number of elements in the + * LCD FMC bank descriptor array of type @ref lcd_fmc_desc_t. + */ +#if DOXYGEN +#define LCD_FMC_NUMOF 1 +#endif + +/** + * @brief Descriptor of the FMC bank used for a LCD + * + * The board definition has to specify the array @ref lcd_fmc_desc of type + * @ref lcd_fmc_desc_t which defines the FMC banks and the address offsets used + * for the LCD displays that are connected to FMC banks. + * + * @note In the case that multiple LCDs are connected to FMC banks, the FMC + * bank descriptors for LCDs of type @ref lcd_fmc_desc_t + * must be defined in same order as the LCD devices. + */ +typedef struct { + const fmc_bank_conf_t *bank; /**< FMC bank config used for the LCD */ + uint32_t cmd_offset; /**< offset to the bank address used for commands */ + uint32_t data_offset; /**< offset to the bank address used for data */ +} lcd_fmc_desc_t; + +#ifdef __cplusplus +} +#endif + +#endif /* LCD_FMC_H */ +/** @} */ diff --git a/cpu/stm32/include/periph/cpu_fmc.h b/cpu/stm32/include/periph/cpu_fmc.h index 53b69cf3e20c6..221d4de820abe 100644 --- a/cpu/stm32/include/periph/cpu_fmc.h +++ b/cpu/stm32/include/periph/cpu_fmc.h @@ -64,6 +64,17 @@ extern "C" { #endif +/** + * @brief Gives the configuration of n-th bank + * + * This macro gives a pointer to the n-th entry of type @ref fmc_bank_conf_t of + * the banks configured by the board in the @ref fmc_bank_config array. n is in + * the range 0 ... @ref FMC_BANK_NUMOF - 1. + */ +#ifndef FMC_BANK_CONFIG +#define FMC_BANK_CONFIG(n) (&fmc_bank_config[n]) +#endif + /** * @brief Number of data pins used * diff --git a/cpu/stm32/lcd_fmc/Kconfig b/cpu/stm32/lcd_fmc/Kconfig new file mode 100644 index 0000000000000..96a3da5c5e140 --- /dev/null +++ b/cpu/stm32/lcd_fmc/Kconfig @@ -0,0 +1,13 @@ +# Copyright (c) 2023 Gunar Schorcht +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config MODULE_LCD_FMC + bool + depends on MODULE_LCD + select MODULE_PERIPH_FMC + select MODULE_PERIPH_FMC_NOR_SRAM + default y if HAVE_LCD_PARALLEL_LL_MCU diff --git a/cpu/stm32/lcd_fmc/Makefile b/cpu/stm32/lcd_fmc/Makefile new file mode 100644 index 0000000000000..3a49fc191f65f --- /dev/null +++ b/cpu/stm32/lcd_fmc/Makefile @@ -0,0 +1,3 @@ +MODULE = lcd_fmc + +include $(RIOTBASE)/Makefile.base diff --git a/cpu/stm32/lcd_fmc/lcd_fmc.c b/cpu/stm32/lcd_fmc/lcd_fmc.c new file mode 100644 index 0000000000000..844bf7e2155fd --- /dev/null +++ b/cpu/stm32/lcd_fmc/lcd_fmc.c @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2023 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup cpu_stm32 + * @ingroup drivers_periph_fmc + * @{ + * + * @file + * @brief FMC peripheral driver implementation + * + * @author Gunar Schorcht + * @} + */ + +#include + +#include "periph/gpio.h" +#include "lcd.h" +#include "lcd_internal.h" +#include "ztimer.h" + +#define ENABLE_DEBUG 0 +#include "debug.h" + +#ifndef LCD_FMC_NUMOF +#define LCD_FMC_NUMOF 1 +#endif + +#define FMC_LCD_CMD(d) (*((__IO uint16_t *)(d->bank->address + d->cmd_offset))) +#define FMC_LCD_DATA(d) (*((__IO uint16_t *)(d->bank->address + d->data_offset))) + +/* sanity check */ +static_assert(LCD_FMC_NUMOF == ARRAY_SIZE(lcd_fmc_desc), + "LCD_FMC_NUMOF is not equal to the number of elements in lcd_fmc_desc"); + +#if LCD_FMC_NUMOF > 1 +/* In the case that multiple LCDs are connected to FMC banks, an array + * for mapping the LCD device pointer to the FMC bank descriptor is used. + * This requires that the FMC bank descriptors for LCDs in `lcd_fmc_desc` + * are defined in same order as the LCD devices. */ +static lcd_t *_lcd_fmc_desc_map[LCD_FMC_NUMOF]; +static uint8_t _lcd_index = 0; + +static inline uint8_t _dev_to_lcd_fmc_desc(lcd_t *dev) +{ + for (uint8_t i = 0; i < LCD_FMC_NUMOF; i++) { + if (_lcd_fmc_desc_map[i] == dev) { + return i; + } + } + assert(false); +} +#endif + +static void lcd_ll_mcu_init(lcd_t *dev) +{ +#if LCD_FMC_NUMOF > 1 + /* The FMC bank descriptors for LCDs in `lcd_fmc_desc` must be defined + * in same order as the LCD display devices. We suppose that the + * LCDs are initialized in that order. */ + assert(_lcd_index < LCD_FMC_NUMOF); + _lcd_fmc_desc_map[_lcd_index++] = dev; +#else + (void)dev; +#endif +} + +static void lcd_ll_mcu_set_data_dir(lcd_t *dev, bool output) +{ + /* no action needed */ + (void)dev; + (void)output; +} + +static void lcd_ll_mcu_cmd_start(lcd_t *dev, uint8_t cmd, bool cont) +{ + DEBUG("[lcd_ll_mcu] write cmd: %02x\n", cmd); + + (void)cont; +#if LCD_FMC_NUMOF > 1 + const lcd_fmc_desc_t *desc = &lcd_fmc_desc[_dev_to_lcd_fmc_desc(dev)]; +#else + (void)dev; + const lcd_fmc_desc_t *desc = lcd_fmc_desc; +#endif + + FMC_LCD_CMD(desc) = cmd; + /* data synchronization barrier seems to be necessary on some STM32 MCUs. */ + __DSB(); +} + +static void lcd_ll_mcu_write_byte(lcd_t *dev, bool cont, uint8_t out) +{ + DEBUG("[lcd_ll_mcu] write byte: %02x\n", out); + + (void)cont; +#if LCD_FMC_NUMOF > 1 + const lcd_fmc_desc_t *desc = &lcd_fmc_desc[_dev_to_lcd_fmc_desc(dev)]; +#else + (void)dev; + const lcd_fmc_desc_t *desc = lcd_fmc_desc; +#endif + + FMC_LCD_DATA(desc) = out; + /* data synchronization barrier seems to be necessary on some STM32 MCUs. */ + __DSB(); +} + +static uint8_t lcd_ll_mcu_read_byte(lcd_t *dev, bool cont) +{ + (void)cont; +#if LCD_FMC_NUMOF > 1 + const lcd_fmc_desc_t *desc = &lcd_fmc_desc[_dev_to_lcd_fmc_desc(dev)]; +#else + (void)dev; + const lcd_fmc_desc_t *desc = lcd_fmc_desc; +#endif + + uint8_t in = FMC_LCD_DATA(desc); + DEBUG("[lcd_ll_mcu] read byte: %02x\n", in); + return in; +} + +#if IS_USED(MODULE_LCD_PARALLEL_16BIT) + +static void lcd_ll_mcu_write_word(lcd_t *dev, bool cont, uint16_t out) +{ + DEBUG("[lcd_ll_mcu] write word: %04x\n", out); + + (void)cont; +#if LCD_FMC_NUMOF > 1 + const lcd_fmc_desc_t *desc = &lcd_fmc_desc[_dev_to_lcd_fmc_desc(dev)]; +#else + (void)dev; + const lcd_fmc_desc_t *desc = lcd_fmc_desc; +#endif + + FMC_LCD_DATA(desc) = out; + /* data synchronization barrier seems to be necessary on some STM32 MCUs. */ + __DSB(); +} + +static uint16_t lcd_ll_mcu_read_word(lcd_t *dev, bool cont) +{ + (void)cont; +#if LCD_FMC_NUMOF > 1 + const lcd_fmc_desc_t *desc = &lcd_fmc_desc[_dev_to_lcd_fmc_desc(dev)]; +#else + (void)dev; + const lcd_fmc_desc_t *desc = lcd_fmc_desc; +#endif + + uint16_t in = FMC_LCD_DATA(desc); + DEBUG("[lcd_ll_mcu] read word: %04x\n", in); + return in; +} + +#endif /* MODULE_LCD_PARALLEL_16BIT */ + +const lcd_ll_par_driver_t lcd_ll_par_driver = { + .init = lcd_ll_mcu_init, + .set_data_dir = lcd_ll_mcu_set_data_dir, + .cmd_start = lcd_ll_mcu_cmd_start, + .write_byte = lcd_ll_mcu_write_byte, + .read_byte = lcd_ll_mcu_read_byte, +#if IS_USED(MODULE_LCD_PARALLEL_16BIT) + .write_word = lcd_ll_mcu_write_word, + .read_word = lcd_ll_mcu_read_word, +#endif +}; From 71a97c2ee9a892803ecb52c2bb7eda9d8c2cb0f6 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 22 Sep 2023 17:08:37 +0200 Subject: [PATCH 2/4] boards/stm32f723e-disco: enable FMC support for LCD --- boards/stm32f723e-disco/Kconfig | 1 + boards/stm32f723e-disco/Makefile.dep | 2 + boards/stm32f723e-disco/include/periph_conf.h | 43 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/boards/stm32f723e-disco/Kconfig b/boards/stm32f723e-disco/Kconfig index d61d833a459a0..31a6910b163d0 100644 --- a/boards/stm32f723e-disco/Kconfig +++ b/boards/stm32f723e-disco/Kconfig @@ -39,6 +39,7 @@ config BOARD_STM32F723E_DISCO select HAVE_FT5X06 select HAVE_ST7789 select HAVE_LCD_PARALLEL_16BIT if MODULE_ST7789 + select HAVE_LCD_PARALLEL_LL_MCU if MODULE_ST7789 select MODULE_PERIPH_UART_HW_FC if HAS_PERIPH_UART_HW_FC && MODULE_PERIPH_UART # Workaround due to stdout only working with stdin enabled diff --git a/boards/stm32f723e-disco/Makefile.dep b/boards/stm32f723e-disco/Makefile.dep index 9547cf1ae5d74..3dd06f4f644c8 100644 --- a/boards/stm32f723e-disco/Makefile.dep +++ b/boards/stm32f723e-disco/Makefile.dep @@ -25,6 +25,8 @@ endif ifneq (,$(filter st7789,$(USEMODULE))) USEMODULE += lcd_parallel_16bit + USEMODULE += lcd_parallel_ll_mcu + FEATURES_REQUIRED += periph_fmc_nor_sram endif # TODO: remove the stdin dependency diff --git a/boards/stm32f723e-disco/include/periph_conf.h b/boards/stm32f723e-disco/include/periph_conf.h index 4a1ccf349321e..91d6c893ff527 100644 --- a/boards/stm32f723e-disco/include/periph_conf.h +++ b/boards/stm32f723e-disco/include/periph_conf.h @@ -42,6 +42,7 @@ #else #include "cfg_usb_otg_fs.h" #endif +#include "lcd_fmc.h" #ifdef __cplusplus extern "C" { @@ -325,6 +326,29 @@ static const fmc_bank_conf_t fmc_bank_config[] = { .bus_turnaround = 3, }, /* 3 HCLKs a 4.63 ns */ }, }, + /* bank 1, subbank 2 is used for LCD with asynchronuous + * access in Mode 1, i.e. write timings are not used */ + { + .bank = FMC_BANK_1, + .mem_type = FMC_SRAM, + .data_width = FMC_BUS_WIDTH_16BIT, + .address = 0x64000000, /* Bank 1, subbank 2 is mapped to 0x64000000 */ + .size = 4, /* 1 word for command @ 0x64000000 and + 1 word for data @ 0x64000001 */ + .nor_sram = { + .sub_bank = 2, + .ext_mode = false, /* Mode 1 used, no separate w_timing */ + /* timing requirements for ST7789H2: + - t_AST min 0 ns (Address setup time) + - t_DST min 10 ns (Data setup time) + - t_WRL min 15 ns (WE LOW time) + - t_WRH min 15 ns (WE HIGH time) + - t_WRC min 66 ns (WE cycle time) */ + .r_timing = { .addr_setup = 2, /* t_AST = 10 ns (2 HCLKs a 4.63 ns) */ + .data_setup = 8, /* t_DST = 37 ns (8 HCLKs a 4.63 ns) */ + .bus_turnaround = 5, }, /* t_WRH = 23 ns (5 HCLKs a 4.63 ns) */ + }, + }, }; /** @@ -333,6 +357,25 @@ static const fmc_bank_conf_t fmc_bank_config[] = { #define FMC_BANK_NUMOF ARRAY_SIZE(fmc_bank_config) /** @} */ +/** + * @brief Descriptors of FMC banks used for LCDs + */ +static const lcd_fmc_desc_t lcd_fmc_desc[] = { + { + .bank = FMC_BANK_CONFIG(1), /* second bank (fmc_bank_config[1]) is used */ + .cmd_offset = 0x0, /* address 0x64000000 (offset 0x0) used for commands */ + .data_offset = 0x2, /* address 0x64000002 (offset 0x2) used for commands */ + } +}; + +/** + * @brief Number of LCDs using FMC banks + * + * Because it is used by the preprocessor it has to be a number. + * The @ref ARRAY_SIZE can't be used here. + */ +#define LCD_FMC_NUMOF 1 + #ifdef __cplusplus } #endif From eb9515132c1e7f9ec5adb1d7060d58c1ab27ca44 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 22 Sep 2023 17:09:46 +0200 Subject: [PATCH 3/4] boards/stm32l496g-disco: enable FMC support for LCD --- boards/stm32l496g-disco/Kconfig | 1 + boards/stm32l496g-disco/Makefile.dep | 2 + boards/stm32l496g-disco/include/periph_conf.h | 44 +++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/boards/stm32l496g-disco/Kconfig b/boards/stm32l496g-disco/Kconfig index e50d8e4843979..e8db1dc0242f2 100644 --- a/boards/stm32l496g-disco/Kconfig +++ b/boards/stm32l496g-disco/Kconfig @@ -45,6 +45,7 @@ config BOARD_STM32L496G_DISCO select HAVE_FT5X06 select HAVE_ST7789 select HAVE_LCD_PARALLEL_16BIT if MODULE_ST7789 + select HAVE_LCD_PARALLEL_LL_MCU if MODULE_ST7789 select MODULE_PERIPH_LPUART if MODULE_PERIPH_UART select MODULE_PERIPH_UART_HW_FC if MODULE_PERIPH_UART && !MODULE_PERIPH_SPI_STMOD && HAS_PERIPH_UART_HW_FC diff --git a/boards/stm32l496g-disco/Makefile.dep b/boards/stm32l496g-disco/Makefile.dep index c63761b6b3c57..f231d8bf46e11 100644 --- a/boards/stm32l496g-disco/Makefile.dep +++ b/boards/stm32l496g-disco/Makefile.dep @@ -28,4 +28,6 @@ endif ifneq (,$(filter st7789,$(USEMODULE))) USEMODULE += lcd_parallel_16bit + USEMODULE += lcd_parallel_ll_mcu + FEATURES_REQUIRED += periph_fmc_nor_sram endif diff --git a/boards/stm32l496g-disco/include/periph_conf.h b/boards/stm32l496g-disco/include/periph_conf.h index 7fb21039b9bf0..0e6d5a5e6f160 100644 --- a/boards/stm32l496g-disco/include/periph_conf.h +++ b/boards/stm32l496g-disco/include/periph_conf.h @@ -30,6 +30,7 @@ #include "clk_conf.h" #include "cfg_rtt_default.h" #include "cfg_usb_otg_fs.h" +#include "lcd_fmc.h" #ifdef __cplusplus extern "C" { @@ -253,12 +254,55 @@ static const fmc_bank_conf_t fmc_bank_config[] = { .bus_turnaround = 1, }, /* 1 HCLK a 12.5 ns */ }, }, + /* bank 1, subbank 1 is used for LCD with asynchronuous + * access in Mode 1, i.e. write timings are not used */ + { + .bank = FMC_BANK_1, + .mem_type = FMC_SRAM, + .data_width = FMC_BUS_WIDTH_16BIT, + .address = 0x60000000, /* Bank 1, subbank 1 is mapped to 0x60000000 */ + .size = 2, /* 1 word for command @ 0x60000000 and + 1 word for data @ 0x60080000 */ + .nor_sram = { + .sub_bank = 1, + .ext_mode = false, /* Mode 1 used, no separate w_timing */ + /* timing requirements for ST7789H2: + - t_AST min 0 ns (Address setup time) + - t_DST min 10 ns (Data setup time) + - t_WRL min 15 ns (WE LOW time) + - t_WRH min 15 ns (WE HIGH time) + - t_WRC min 66 ns (WE cycle time) */ + .r_timing = { .addr_setup = 1, /* t_AST = 12 ns (1 HCLKs a 12.5 ns) */ + .data_setup = 3, /* t_DST = 37 ns (3 HCLKs a 12.5 ns) */ + .bus_turnaround = 2, }, /* t_WRH = 25 ns (2 HCLKs a 12.5 ns) */ + }, + }, }; /** * @brief Number of configured FMC banks */ #define FMC_BANK_NUMOF ARRAY_SIZE(fmc_bank_config) + +/** + * @brief Descriptors of FMC banks used for LCDs + */ +static const lcd_fmc_desc_t lcd_fmc_desc[] = { + { + .bank = FMC_BANK_CONFIG(1), /* second bank (fmc_bank_config[1]) is used */ + .cmd_offset = 0x0, /* address 0x60000000 (offset 0x00000) used for commands */ + .data_offset = 0x80000, /* address 0x60080000 (offset 0x80000) used for data */ + } +}; + +/** + * @brief Number of LCDs using FMC banks + * + * Because it is used by the preprocessor it has to be a number. + * The @ref ARRAY_SIZE can't be used here. + */ +#define LCD_FMC_NUMOF 1 + /** @} */ /** From 391f303d41b61e55a71c2dbd15b42abf8f7e1d73 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 30 Jul 2023 16:16:33 +0200 Subject: [PATCH 4/4] tests/drivers/st77xx: add benchmarking --- tests/drivers/st77xx/Makefile | 1 + tests/drivers/st77xx/app.config.test | 1 + tests/drivers/st77xx/main.c | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/drivers/st77xx/Makefile b/tests/drivers/st77xx/Makefile index d83318080241e..742b0e7101e18 100644 --- a/tests/drivers/st77xx/Makefile +++ b/tests/drivers/st77xx/Makefile @@ -23,6 +23,7 @@ endif DRIVER ?= st7735 USEMODULE += $(DRIVER) +USEMODULE += benchmark USEMODULE += ztimer USEMODULE += ztimer_msec diff --git a/tests/drivers/st77xx/app.config.test b/tests/drivers/st77xx/app.config.test index 375fca9b18565..61d58608061c5 100644 --- a/tests/drivers/st77xx/app.config.test +++ b/tests/drivers/st77xx/app.config.test @@ -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 diff --git a/tests/drivers/st77xx/main.c b/tests/drivers/st77xx/main.c index d6bfffec4dbfe..723543ae68394 100644 --- a/tests/drivers/st77xx/main.c +++ b/tests/drivers/st77xx/main.c @@ -23,6 +23,7 @@ #include #include "timex.h" #include "ztimer.h" +#include "benchmark.h" #include "board.h" #include "lcd.h" #include "lcd_internal.h" @@ -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) {}