diff --git a/drivers/tsl2561/Kconfig b/drivers/tsl2561/Kconfig index 0d29518a8c..b394276f6c 100644 --- a/drivers/tsl2561/Kconfig +++ b/drivers/tsl2561/Kconfig @@ -10,4 +10,5 @@ config MODULE_TSL2561 depends on HAS_PERIPH_I2C depends on TEST_KCONFIG select MODULE_PERIPH_I2C - select MODULE_XTIMER + select MODULE_ZTIMER + select MODULE_ZTIMER_MSEC diff --git a/drivers/tsl2561/Makefile.dep b/drivers/tsl2561/Makefile.dep index 9508a8aff7..40e4e2276c 100644 --- a/drivers/tsl2561/Makefile.dep +++ b/drivers/tsl2561/Makefile.dep @@ -1,2 +1,3 @@ FEATURES_REQUIRED += periph_i2c -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec diff --git a/drivers/tsl2561/tsl2561.c b/drivers/tsl2561/tsl2561.c index df7528cbc4..b02a187917 100644 --- a/drivers/tsl2561/tsl2561.c +++ b/drivers/tsl2561/tsl2561.c @@ -25,7 +25,7 @@ #include "tsl2561.h" #include "tsl2561_internals.h" #include "periph/i2c.h" -#include "xtimer.h" +#include "ztimer.h" #define ENABLE_DEBUG 0 #include "debug.h" @@ -220,16 +220,16 @@ static void _read_data(const tsl2561_t *dev, uint16_t *full, uint16_t *ir) /* Wait integration time in ms for ADC to complete */ switch (DEV_INTEGRATION) { - case TSL2561_INTEGRATIONTIME_13MS: - xtimer_usleep(13700); + case TSL2561_INTEGRATIONTIME_13MS: /* 13700us */ + ztimer_sleep(ZTIMER_MSEC, 14); break; case TSL2561_INTEGRATIONTIME_101MS: - xtimer_usleep(101000); + ztimer_sleep(ZTIMER_MSEC, 101); break; default: /* TSL2561_INTEGRATIONTIME_402MS */ - xtimer_usleep(402000); + ztimer_sleep(ZTIMER_MSEC, 402); break; } diff --git a/tests/driver_tsl2561/Makefile b/tests/driver_tsl2561/Makefile index d1a27e3699..d17c3646be 100644 --- a/tests/driver_tsl2561/Makefile +++ b/tests/driver_tsl2561/Makefile @@ -1,6 +1,7 @@ include ../Makefile.tests_common USEMODULE += tsl2561 -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_tsl2561/app.config.test b/tests/driver_tsl2561/app.config.test index 908d3b509d..0b1f62677c 100644 --- a/tests/driver_tsl2561/app.config.test +++ b/tests/driver_tsl2561/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_TSL2561=y -CONFIG_MODULE_XTIMER=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_MSEC=y diff --git a/tests/driver_tsl2561/main.c b/tests/driver_tsl2561/main.c index 1cf4209b5f..b603a255f6 100644 --- a/tests/driver_tsl2561/main.c +++ b/tests/driver_tsl2561/main.c @@ -21,14 +21,13 @@ #include #include -#include "xtimer.h" +#include "timex.h" +#include "ztimer.h" #include "board.h" #include "tsl2561.h" #include "tsl2561_params.h" -#define SLEEP_1S (1 * 1000 * 1000u) /* 1 second delay between printf */ - int main(void) { puts("TSL2561 test application\n"); @@ -58,7 +57,7 @@ int main(void) "\n+-------------------------------------+\n", (int)tsl2561_read_illuminance(&dev)); - xtimer_usleep(SLEEP_1S); + ztimer_sleep(ZTIMER_MSEC, MS_PER_SEC); /* 1s delay */ } return 0;