From 097b1970d28cfa09b6cbfdf2f80d4291f227c410 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 10 Dec 2021 14:10:36 +0100 Subject: [PATCH] drivers/pulse_counter: migrate to ztimer --- drivers/pulse_counter/Kconfig | 1 - drivers/pulse_counter/Makefile.dep | 1 - tests/driver_pulse_counter/Makefile | 3 +++ tests/driver_pulse_counter/app.config.test | 2 ++ tests/driver_pulse_counter/main.c | 7 ++++--- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/pulse_counter/Kconfig b/drivers/pulse_counter/Kconfig index 6221b4e017..27f0422809 100644 --- a/drivers/pulse_counter/Kconfig +++ b/drivers/pulse_counter/Kconfig @@ -12,4 +12,3 @@ config MODULE_PULSE_COUNTER depends on TEST_KCONFIG select MODULE_PERIPH_GPIO select MODULE_PERIPH_GPIO_IRQ - select MODULE_XTIMER diff --git a/drivers/pulse_counter/Makefile.dep b/drivers/pulse_counter/Makefile.dep index e082208872..e646b44f6c 100644 --- a/drivers/pulse_counter/Makefile.dep +++ b/drivers/pulse_counter/Makefile.dep @@ -1,2 +1 @@ -USEMODULE += xtimer FEATURES_REQUIRED += periph_gpio_irq diff --git a/tests/driver_pulse_counter/Makefile b/tests/driver_pulse_counter/Makefile index 44b831d771..adbeeb2a08 100644 --- a/tests/driver_pulse_counter/Makefile +++ b/tests/driver_pulse_counter/Makefile @@ -4,4 +4,7 @@ BOARD_BLACKLIST := msb-430 msb-430h telosb z1 USEMODULE += pulse_counter +USEMODULE += ztimer +USEMODULE += ztimer_msec + include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_pulse_counter/app.config.test b/tests/driver_pulse_counter/app.config.test index 7d11aed684..c73ad82205 100644 --- a/tests/driver_pulse_counter/app.config.test +++ b/tests/driver_pulse_counter/app.config.test @@ -1,3 +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_PULSE_COUNTER=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_MSEC=y diff --git a/tests/driver_pulse_counter/main.c b/tests/driver_pulse_counter/main.c index dad3ad70ba..d9f79ce16d 100644 --- a/tests/driver_pulse_counter/main.c +++ b/tests/driver_pulse_counter/main.c @@ -20,10 +20,11 @@ #include -#include "xtimer.h" +#include "timex.h" +#include "ztimer.h" #include "pulse_counter_params.h" -#define SLEEP_USEC US_PER_SEC +#define SLEEP_MS MS_PER_SEC int main(void) { @@ -45,7 +46,7 @@ int main(void) int16_t count = pulse_counter_read_with_reset(&dev); printf("pulse counter: %d\n", count); - xtimer_usleep(SLEEP_USEC); + ztimer_sleep(ZTIMER_MSEC, SLEEP_MS); } return 0;