diff --git a/drivers/ad7746/Kconfig b/drivers/ad7746/Kconfig index dcef773d48..5ddd7b2363 100644 --- a/drivers/ad7746/Kconfig +++ b/drivers/ad7746/Kconfig @@ -10,5 +10,7 @@ config MODULE_AD7746 depends on HAS_PERIPH_I2C depends on TEST_KCONFIG select MODULE_PERIPH_I2C + select MODULE_ZTIMER + select MODULE_ZTIMER_MSEC help AD7746 Capacitance-to-digital converter with temperature sensor driver. diff --git a/drivers/ad7746/Makefile.dep b/drivers/ad7746/Makefile.dep index e67057d463..40e4e2276c 100644 --- a/drivers/ad7746/Makefile.dep +++ b/drivers/ad7746/Makefile.dep @@ -1 +1,3 @@ FEATURES_REQUIRED += periph_i2c +USEMODULE += ztimer +USEMODULE += ztimer_msec diff --git a/drivers/ad7746/ad7746.c b/drivers/ad7746/ad7746.c index ef2fb19af2..7c633ab714 100644 --- a/drivers/ad7746/ad7746.c +++ b/drivers/ad7746/ad7746.c @@ -20,6 +20,8 @@ #include +#include "ztimer.h" + #include "ad7746.h" #include "ad7746_params.h" #include "ad7746_internal.h" @@ -30,8 +32,6 @@ #define ENABLE_DEBUG 0 #include "debug.h" -#include "xtimer.h" - #define DEV (dev->params.i2c) #define ADDR (dev->params.addr) @@ -382,7 +382,7 @@ static int _read_voltage_temp(ad7746_t *dev, int *value, ad7746_vt_mode_t mode) /* if a mode change is needed wait for a conversion cycle and flush * the first sample in order to get a stable output. Took from the Linux * driver implementation */ - xtimer_msleep(_vt_sr_times[dev->params.vt_sample_rate]); + ztimer_sleep(ZTIMER_MSEC, _vt_sr_times[dev->params.vt_sample_rate]); _read_raw_ch(dev, AD7746_READ_VT_CH, &raw); } diff --git a/tests/driver_ad7746/Makefile b/tests/driver_ad7746/Makefile index 5210f9f821..c730469354 100644 --- a/tests/driver_ad7746/Makefile +++ b/tests/driver_ad7746/Makefile @@ -1,6 +1,7 @@ include ../Makefile.tests_common USEMODULE += ad7746 -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_ad7746/app.config.test b/tests/driver_ad7746/app.config.test index 96cdd8614a..df0b862965 100644 --- a/tests/driver_ad7746/app.config.test +++ b/tests/driver_ad7746/app.config.test @@ -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_AD7746=y -CONFIG_MODULE_XTIMER=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_MSEC=y diff --git a/tests/driver_ad7746/main.c b/tests/driver_ad7746/main.c index c979628e1c..a750a01d2b 100644 --- a/tests/driver_ad7746/main.c +++ b/tests/driver_ad7746/main.c @@ -20,12 +20,12 @@ #include -#include "xtimer.h" +#include "ztimer.h" #include "timex.h" #include "ad7746.h" #include "ad7746_params.h" -#define SLEEP_USEC (1000 * US_PER_MS) +#define SLEEP_MS (MS_PER_SEC) static ad7746_t dev; @@ -84,7 +84,7 @@ int main(void) printf("Error reading internal temperature\n"); } puts(""); - xtimer_usleep(SLEEP_USEC); + ztimer_sleep(ZTIMER_MSEC, SLEEP_MS); } return 0;