diff --git a/tests/driver_ltc4150/Makefile b/tests/driver_ltc4150/Makefile index bef4297864..dbb7fb4639 100644 --- a/tests/driver_ltc4150/Makefile +++ b/tests/driver_ltc4150/Makefile @@ -4,6 +4,7 @@ BOARD ?= msba2 USEMODULE += fmt_table USEMODULE += ltc4150 +USEMODULE += ztimer_usec include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_ltc4150/main.c b/tests/driver_ltc4150/main.c index 0591d43bae..3b784e62ed 100644 --- a/tests/driver_ltc4150/main.c +++ b/tests/driver_ltc4150/main.c @@ -25,7 +25,8 @@ #include "led.h" #include "ltc4150.h" #include "thread.h" -#include "xtimer.h" +#include "ztimer.h" +#include "timex.h" typedef struct { uint64_t last_usec; @@ -96,8 +97,7 @@ static void pulse_cb(ltc4150_dev_t *dev, ltc4150_dir_t dir, uint64_t now_usec, */ static void spin(uint32_t seconds) { - uint32_t till = xtimer_now_usec() + US_PER_SEC * seconds; - while (xtimer_now_usec() < till) { } + ztimer_spin(ZTIMER_USEC, US_PER_SEC * seconds); } /** @@ -110,14 +110,14 @@ static void *busy_thread(void *arg) /* one minute of ~0% CPU usage */ LED0_OFF; LED1_OFF; - xtimer_sleep(60); + ztimer_sleep(ZTIMER_USEC, 60 * US_PER_SEC); change_of_load_level = 1; /* one minute of ~50% CPU usage */ for (unsigned i = 0; i < 30; i++) { LED0_OFF; LED1_OFF; - xtimer_sleep(1); + ztimer_sleep(ZTIMER_USEC, 1 * US_PER_SEC); LED0_ON; LED1_ON; spin(1);