From 97472047d7b97270a72ef587a7ffc40aa02de69c Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 9 Dec 2021 10:22:12 +0100 Subject: [PATCH] tests/driver_io1_xplained: use ztimer --- tests/driver_io1_xplained/Makefile | 2 +- tests/driver_io1_xplained/app.config.test | 2 ++ tests/driver_io1_xplained/main.c | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/driver_io1_xplained/Makefile b/tests/driver_io1_xplained/Makefile index aaf497be5c..8f2778a9cc 100644 --- a/tests/driver_io1_xplained/Makefile +++ b/tests/driver_io1_xplained/Makefile @@ -1,6 +1,6 @@ include ../Makefile.tests_common USEMODULE += io1_xplained -USEMODULE += xtimer +USEMODULE += ztimer_msec include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_io1_xplained/app.config.test b/tests/driver_io1_xplained/app.config.test index e4b6c2be24..46cb463bec 100644 --- a/tests/driver_io1_xplained/app.config.test +++ b/tests/driver_io1_xplained/app.config.test @@ -3,3 +3,5 @@ CONFIG_MODULE_IO1_XPLAINED=y CONFIG_MODULE_AT30TSE75X=y CONFIG_MODULE_SDCARD_SPI=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_MSEC=y diff --git a/tests/driver_io1_xplained/main.c b/tests/driver_io1_xplained/main.c index 69c41042d3..5d01e5059e 100644 --- a/tests/driver_io1_xplained/main.c +++ b/tests/driver_io1_xplained/main.c @@ -21,7 +21,8 @@ #include #include -#include "xtimer.h" +#include "timex.h" +#include "ztimer.h" #include "board.h" #include "periph/gpio.h" @@ -31,7 +32,7 @@ #include "io1_xplained.h" #include "io1_xplained_params.h" -#define DELAY_1S (1U) /* 1 seconds delay between each test */ +#define DELAY_1S (1U * MS_PER_SEC) /* 1 seconds delay between each test */ static io1_xplained_t dev; @@ -71,12 +72,12 @@ int main(void) "+-------------------------------------+\n", (int)temperature, (unsigned)((temperature - (int)temperature) * 1000)); - xtimer_sleep(DELAY_1S); + ztimer_sleep(ZTIMER_MSEC, DELAY_1S); /* Card detect pin is inverted */ if (!gpio_read(IO1_SDCARD_SPI_PARAM_DETECT)) { _sd_card_cid(); - xtimer_sleep(DELAY_1S); + ztimer_sleep(ZTIMER_MSEC, DELAY_1S); } uint16_t light; @@ -84,23 +85,23 @@ int main(void) printf("Light level: %i\n" "+-------------------------------------+\n", light); - xtimer_sleep(DELAY_1S); + ztimer_sleep(ZTIMER_MSEC, DELAY_1S); /* set led */ gpio_set(IO1_LED_PIN); - xtimer_sleep(DELAY_1S); + ztimer_sleep(ZTIMER_MSEC, DELAY_1S); /* clear led */ gpio_clear(IO1_LED_PIN); - xtimer_sleep(DELAY_1S); + ztimer_sleep(ZTIMER_MSEC, DELAY_1S); /* toggle led */ gpio_toggle(IO1_LED_PIN); - xtimer_sleep(DELAY_1S); + ztimer_sleep(ZTIMER_MSEC, DELAY_1S); /* toggle led again */ gpio_toggle(IO1_LED_PIN); - xtimer_sleep(DELAY_1S); + ztimer_sleep(ZTIMER_MSEC, DELAY_1S); } return 0;