From 1e5f84ef7126d0f914d6f706c318515ee5d98911 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 2 Dec 2021 14:02:29 +0100 Subject: [PATCH] tests/periph_adc: migrate to ztimer --- tests/periph_adc/Makefile | 3 ++- tests/periph_adc/app.config.test | 3 ++- tests/periph_adc/main.c | 8 +++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/periph_adc/Makefile b/tests/periph_adc/Makefile index 171eadae46..50f2c9e963 100644 --- a/tests/periph_adc/Makefile +++ b/tests/periph_adc/Makefile @@ -2,6 +2,7 @@ BOARD ?= pba-d-01-kw2x include ../Makefile.tests_common FEATURES_REQUIRED = periph_adc -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec include $(RIOTBASE)/Makefile.include diff --git a/tests/periph_adc/app.config.test b/tests/periph_adc/app.config.test index d73989b77d..a1651740ff 100644 --- a/tests/periph_adc/app.config.test +++ b/tests/periph_adc/app.config.test @@ -4,4 +4,5 @@ CONFIG_MODULE_PERIPH_ADC=y # enable xtimer to wake up periodically -CONFIG_MODULE_XTIMER=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_MSEC=y diff --git a/tests/periph_adc/main.c b/tests/periph_adc/main.c index 9a39283f21..6ff1742b23 100644 --- a/tests/periph_adc/main.c +++ b/tests/periph_adc/main.c @@ -20,16 +20,14 @@ #include -#include "xtimer.h" -#include "timex.h" +#include "ztimer.h" #include "periph/adc.h" #define RES ADC_RES_10BIT -#define DELAY (100LU * US_PER_MS) /* 100 ms */ +#define DELAY_MS 100U int main(void) { - xtimer_ticks32_t last = xtimer_now(); int sample = 0; puts("\nRIOT ADC peripheral driver test\n"); @@ -55,7 +53,7 @@ int main(void) printf("ADC_LINE(%u): %i\n", i, sample); } } - xtimer_periodic_wakeup(&last, DELAY); + ztimer_sleep(ZTIMER_MSEC, DELAY_MS); } return 0;