1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00

Merge pull request #17031 from fjmolinas/pr_lvgl_ztimer

pkg/lvgl: use ztimer instead of xtimer
This commit is contained in:
Alexandre Abadie 2021-10-28 11:36:04 +02:00 committed by GitHub
commit dbbdc8590e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 30 additions and 24 deletions

View File

@ -12,7 +12,8 @@ config MODULE_ILI9341
depends on TEST_KCONFIG
select MODULE_PERIPH_SPI
select MODULE_PERIPH_GPIO
select MODULE_XTIMER
select MODULE_ZTIMER
select MODULE_ZTIMER_MSEC
menuconfig KCONFIG_USEMODULE_ILI9341
bool "Configure ILI9341 driver"

View File

@ -1,3 +1,4 @@
FEATURES_REQUIRED += periph_spi
FEATURES_REQUIRED += periph_gpio
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_msec

View File

@ -22,7 +22,7 @@
#include <string.h>
#include "byteorder.h"
#include "periph/spi.h"
#include "xtimer.h"
#include "ztimer.h"
#include "kernel_defines.h"
#include "ili9341.h"
@ -101,16 +101,16 @@ int ili9341_init(ili9341_t *dev, const ili9341_params_t *params)
if (gpio_is_valid(dev->params->rst_pin)) {
gpio_init(dev->params->rst_pin, GPIO_OUT);
gpio_clear(dev->params->rst_pin);
xtimer_msleep(120);
ztimer_sleep(ZTIMER_MSEC, 120);
gpio_set(dev->params->rst_pin);
}
xtimer_msleep(120);
ztimer_sleep(ZTIMER_MSEC, 120);
/* Acquire once at release at the end */
_ili9341_spi_acquire(dev);
/* Soft Reset */
_write_cmd(dev, ILI9341_CMD_SWRESET, NULL, 0);
xtimer_msleep(120);
ztimer_sleep(ZTIMER_MSEC, 120);
/* Display off */
_write_cmd(dev, ILI9341_CMD_DISPOFF, NULL, 0);

View File

@ -31,7 +31,8 @@ config MODULE_LVGL_CONTRIB
bool "Contrib"
select MODULE_DISP_DEV
select MODULE_CORE_THREAD_FLAGS
select MODULE_XTIMER
select MODULE_ZTIMER
select MODULE_ZTIMER_MSEC
config MODULE_LVGL_CONTRIB_TOUCH
bool "Touch support"

View File

@ -10,7 +10,8 @@ USEMODULE += lvgl_widgets
ifneq (,$(filter lvgl_contrib,$(USEMODULE)))
USEMODULE += disp_dev
USEMODULE += core_thread_flags
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_msec
endif
ifneq (,$(filter lvgl_contrib_touch,$(USEMODULE)))

View File

@ -22,7 +22,8 @@
#include "kernel_defines.h"
#include "thread.h"
#include "xtimer.h"
#include "timex.h"
#include "ztimer.h"
#include "log.h"
#include "lvgl/lvgl.h"
@ -38,8 +39,8 @@
#define CONFIG_LVGL_INACTIVITY_PERIOD_MS (5 * MS_PER_SEC) /* 5s */
#endif
#ifndef CONFIG_LVGL_TASK_HANDLER_DELAY_US
#define CONFIG_LVGL_TASK_HANDLER_DELAY_US (5 * US_PER_MS) /* 5ms */
#ifndef CONFIG_LVGL_TASK_HANDLER_DELAY_MS
#define CONFIG_LVGL_TASK_HANDLER_DELAY_MS (5) /* 5ms */
#endif
#ifndef LVGL_THREAD_FLAG
@ -146,7 +147,7 @@ void lvgl_run(void)
lv_disp_trig_activity(NULL);
}
xtimer_usleep(CONFIG_LVGL_TASK_HANDLER_DELAY_US);
ztimer_sleep(ZTIMER_MSEC, CONFIG_LVGL_TASK_HANDLER_DELAY_MS);
}
}

View File

@ -15,7 +15,7 @@ LVGL_TASK_THREAD_PRIO cannot be configured via Kconfig.
- `CONFIG_LVGL_INACTIVITY_PERIOD_MS`: maximum inactivity period before going to sleep in ms.
(default: 5s)
- `CONFIG_LVGL_TASK_HANDLER_DELAY_US`: delay between lvgl task handle call in us.
- `CONFIG_LVGL_TASK_HANDLER_DELAY_MS`: delay between lvgl task handle call in us.
(default: 5ms)
- `LVGL_TASK_THREAD_PRIO`: lvgl task handler thread priority.
(default: THREAD_PRIORITY_MAIN - 1)

View File

@ -28,8 +28,8 @@ typedef int16_t lv_coord_t;
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "xtimer.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (xtimer_now_usec() / US_PER_MS) /*Expression evaluating to current systime in ms*/
#define LV_TICK_CUSTOM_INCLUDE "ztimer.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (ztimer_now(ZTIMER_MSEC)) /*Expression evaluating to current systime in ms*/
#endif /*LV_TICK_CUSTOM*/
#ifdef __cplusplus

View File

@ -2,7 +2,8 @@ BOARD ?= stm32f429i-disc1
include ../Makefile.tests_common
USEMODULE += ili9341
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_msec
include $(RIOTBASE)/Makefile.include

View File

@ -1,4 +1,5 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_ILI9341=y
CONFIG_MODULE_XTIMER=y
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_MSEC=y

View File

@ -19,7 +19,8 @@
*/
#include <stdio.h>
#include "xtimer.h"
#include "timex.h"
#include "ztimer.h"
#include "board.h"
#include "ili9341.h"
#include "ili9341_params.h"
@ -55,19 +56,19 @@ int main(void)
/* Fill square with blue */
puts("Drawing blue rectangle");
ili9341_fill(&dev, 10, 59, 10, 109, 0x001F);
xtimer_sleep(1);
ztimer_sleep(ZTIMER_MSEC, 1 * MS_PER_SEC);
puts("Drawing green rectangle");
ili9341_fill(&dev, 10, 59, 10, 109, 0x07E0);
xtimer_sleep(1);
ztimer_sleep(ZTIMER_MSEC, 1 * MS_PER_SEC);
puts("Drawing red rectangle");
ili9341_fill(&dev, 10, 59, 10, 109, 0xf800);
xtimer_sleep(1);
ztimer_sleep(ZTIMER_MSEC, 1 * MS_PER_SEC);
ili9341_invert_on(&dev);
puts("ili9341 TFT display inverted");
xtimer_sleep(1);
ztimer_sleep(ZTIMER_MSEC, 1 * MS_PER_SEC);
ili9341_invert_off(&dev);
puts("ili9341 TFT display normal");

View File

@ -20,8 +20,6 @@
#include <string.h>
#include "xtimer.h"
#include "lvgl/lvgl.h"
#include "lvgl_riot.h"
#include "disp_dev.h"