diff --git a/drivers/ccs811/Kconfig b/drivers/ccs811/Kconfig index 95c2eccbff..872c5f1f91 100644 --- a/drivers/ccs811/Kconfig +++ b/drivers/ccs811/Kconfig @@ -12,7 +12,9 @@ menuconfig MODULE_CCS811 depends on TEST_KCONFIG select MODULE_PERIPH_GPIO select MODULE_PERIPH_I2C - select MODULE_XTIMER + select MODULE_ZTIMER + select MODULE_ZTIMER_USEC + select MODULE_ZTIMER_PERIPH_TIMER config MODULE_CCS811_FULL bool "Full functionalities" diff --git a/drivers/ccs811/Makefile.dep b/drivers/ccs811/Makefile.dep index 659858548a..0fd0f94c86 100644 --- a/drivers/ccs811/Makefile.dep +++ b/drivers/ccs811/Makefile.dep @@ -1,6 +1,7 @@ FEATURES_REQUIRED += periph_gpio FEATURES_REQUIRED += periph_i2c -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_usec ifneq (,$(filter ccs811_full,$(USEMODULE))) FEATURES_REQUIRED += periph_gpio_irq diff --git a/drivers/ccs811/ccs811.c b/drivers/ccs811/ccs811.c index 453b12e418..f2248d2a1c 100644 --- a/drivers/ccs811/ccs811.c +++ b/drivers/ccs811/ccs811.c @@ -19,7 +19,7 @@ #include #include "log.h" -#include "xtimer.h" +#include "ztimer.h" #include "ccs811_regs.h" #include "ccs811.h" @@ -82,11 +82,11 @@ int ccs811_init(ccs811_t *dev, const ccs811_params_t *params) /* enable low active reset signal */ gpio_clear(dev->params.reset_pin); /* t_RESET (reset impuls) has to be at least 20 us, we wait 1 ms */ - xtimer_usleep(1000); + ztimer_sleep(ZTIMER_USEC, 1000); /* disable low active reset signal */ gpio_set(dev->params.reset_pin); /* t_START after reset is 1 ms, we wait 1 further ms */ - xtimer_usleep(1000); + ztimer_sleep(ZTIMER_USEC, 1000); } if (gpio_is_valid(dev->params.wake_pin) && @@ -112,7 +112,7 @@ int ccs811_init(ccs811_t *dev, const ccs811_params_t *params) uint8_t status; /* wait 100 ms after the reset */ - xtimer_usleep(100000); + ztimer_sleep(ZTIMER_USEC, 100000); /* get the status to check whether sensor is in bootloader mode */ if (_reg_read(dev, CCS811_REG_STATUS, &status, 1) != CCS811_OK) { @@ -139,7 +139,7 @@ int ccs811_init(ccs811_t *dev, const ccs811_params_t *params) } /* wait 100 ms after starting the app */ - xtimer_usleep(100000); + ztimer_sleep(ZTIMER_USEC, 100000); /* get the status to check whether sensor switched to application mode */ if (_reg_read(dev, CCS811_REG_STATUS, &status, 1) != CCS811_OK) { @@ -482,7 +482,7 @@ static int _reg_read(const ccs811_t *dev, uint8_t reg, uint8_t *data, uint32_t l /* wake the sensor with low active WAKE signal */ gpio_clear(dev->params.wake_pin); /* t_WAKE is 50 us */ - xtimer_usleep(50); + ztimer_sleep(ZTIMER_USEC, 50); } #endif @@ -494,7 +494,7 @@ static int _reg_read(const ccs811_t *dev, uint8_t reg, uint8_t *data, uint32_t l /* let the sensor enter to sleep mode */ gpio_set(dev->params.wake_pin); /* minimum t_DWAKE is 20 us */ - xtimer_usleep(20); + ztimer_sleep(ZTIMER_USEC, 20); } #endif @@ -540,7 +540,7 @@ static int _reg_write(const ccs811_t *dev, uint8_t reg, uint8_t *data, uint32_t /* wake the sensor with low active WAKE signal */ gpio_clear(dev->params.wake_pin); /* t_WAKE is 50 us */ - xtimer_usleep(50); + ztimer_sleep(ZTIMER_USEC, 50); } #endif @@ -557,7 +557,7 @@ static int _reg_write(const ccs811_t *dev, uint8_t reg, uint8_t *data, uint32_t /* let the sensor enter to sleep mode */ gpio_set(dev->params.wake_pin); /* minimum t_DWAKE is 20 us */ - xtimer_usleep(20); + ztimer_sleep(ZTIMER_USEC, 20); } #endif diff --git a/drivers/lsm6dsl/Kconfig b/drivers/lsm6dsl/Kconfig index 9cfc920094..ce0cae1fa6 100644 --- a/drivers/lsm6dsl/Kconfig +++ b/drivers/lsm6dsl/Kconfig @@ -10,4 +10,5 @@ config MODULE_LSM6DSL 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/lsm6dsl/Makefile.dep b/drivers/lsm6dsl/Makefile.dep index 9508a8aff7..40e4e2276c 100644 --- a/drivers/lsm6dsl/Makefile.dep +++ b/drivers/lsm6dsl/Makefile.dep @@ -1,2 +1,3 @@ FEATURES_REQUIRED += periph_i2c -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec diff --git a/drivers/lsm6dsl/include/lsm6dsl_internal.h b/drivers/lsm6dsl/include/lsm6dsl_internal.h index 0f99dbc78b..b9a9b48ecc 100644 --- a/drivers/lsm6dsl/include/lsm6dsl_internal.h +++ b/drivers/lsm6dsl/include/lsm6dsl_internal.h @@ -22,8 +22,6 @@ #ifndef LSM6DSL_INTERNAL_H #define LSM6DSL_INTERNAL_H -#include "xtimer.h" - #ifdef __cplusplus extern "C" { #endif @@ -159,9 +157,9 @@ extern "C" { #define LSM6DSL_TEMP_OFFSET (0x1900) /** - * @brief Reboot wait interval in us (15ms) + * @brief Reboot wait interval in ms (15ms) */ -#define LSM6DSL_BOOT_WAIT (15 * US_PER_MS) +#define LSM6DSL_BOOT_WAIT_MS (15) #ifdef __cplusplus } diff --git a/drivers/lsm6dsl/lsm6dsl.c b/drivers/lsm6dsl/lsm6dsl.c index 237ff55b39..57672b83f3 100644 --- a/drivers/lsm6dsl/lsm6dsl.c +++ b/drivers/lsm6dsl/lsm6dsl.c @@ -22,7 +22,7 @@ #include -#include "xtimer.h" +#include "ztimer.h" #include "lsm6dsl.h" #include "lsm6dsl_internal.h" @@ -62,7 +62,7 @@ int lsm6dsl_init(lsm6dsl_t *dev, const lsm6dsl_params_t *params) /* Reboot */ i2c_write_reg(BUS, ADDR, LSM6DSL_REG_CTRL3_C, LSM6DSL_CTRL3_C_BOOT, 0); - xtimer_usleep(LSM6DSL_BOOT_WAIT); + ztimer_sleep(ZTIMER_MSEC, LSM6DSL_BOOT_WAIT_MS); if (i2c_read_reg(BUS, ADDR, LSM6DSL_REG_WHO_AM_I, &tmp, 0) < 0) { i2c_release(BUS); diff --git a/drivers/si114x/Kconfig b/drivers/si114x/Kconfig index e6eb07c3b9..099f545860 100644 --- a/drivers/si114x/Kconfig +++ b/drivers/si114x/Kconfig @@ -31,6 +31,7 @@ config MODULE_SI114X bool depends on HAS_PERIPH_I2C select MODULE_PERIPH_I2C - select MODULE_XTIMER + select MODULE_ZTIMER + select MODULE_ZTIMER_MSEC endif # TEST_KCONFIG diff --git a/drivers/si114x/Makefile.dep b/drivers/si114x/Makefile.dep index 095389d9a5..f053614553 100644 --- a/drivers/si114x/Makefile.dep +++ b/drivers/si114x/Makefile.dep @@ -1,2 +1,3 @@ -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec FEATURES_REQUIRED += periph_i2c diff --git a/drivers/si114x/include/si114x_internals.h b/drivers/si114x/include/si114x_internals.h index bb7081b921..c7b71d46e8 100644 --- a/drivers/si114x/include/si114x_internals.h +++ b/drivers/si114x/include/si114x_internals.h @@ -161,8 +161,8 @@ extern "C" { #define SI1145_ID (0x45) #define SI1146_ID (0x46) #define SI1147_ID (0x47) -#define SI114X_STARTUP_TIME (25000UL) /* 25ms */ -#define SI114X_WAIT_10MS (10000UL) /* 10ms */ +#define SI114X_STARTUP_TIME_MS (25UL) /**< startup time (25ms) */ +#define SI114X_WAIT_10MS (10UL) /* 10ms */ #define SI114X_INIT_VALUE (0x17) #define SI114X_UCOEF0_DEFAULT (0x29) #define SI114X_UCOEF1_DEFAULT (0x89) diff --git a/drivers/si114x/si114x.c b/drivers/si114x/si114x.c index bf4e1f41f9..e3d98bac67 100644 --- a/drivers/si114x/si114x.c +++ b/drivers/si114x/si114x.c @@ -24,7 +24,7 @@ #include #include -#include "xtimer.h" +#include "ztimer.h" #include "periph/i2c.h" @@ -50,7 +50,7 @@ int8_t si114x_init(si114x_t *dev, const si114x_params_t *params) dev->params = *params; /* wait before sensor is ready */ - xtimer_usleep(SI114X_STARTUP_TIME); + ztimer_sleep(ZTIMER_MSEC, SI114X_STARTUP_TIME_MS); /* acquire exclusive access */ i2c_acquire(DEV_I2C); @@ -178,12 +178,12 @@ void _reset(si114x_t *dev) /* perform RESET command */ i2c_write_reg(DEV_I2C, SI114X_ADDR, SI114X_REG_COMMAND, SI114X_RESET, 0); - xtimer_usleep(SI114X_WAIT_10MS); + ztimer_sleep(ZTIMER_MSEC, SI114X_WAIT_10MS); /* write HW_KEY for proper operation */ i2c_write_reg(DEV_I2C, SI114X_ADDR, SI114X_REG_HW_KEY, SI114X_INIT_VALUE, 0); - xtimer_usleep(SI114X_WAIT_10MS); + ztimer_sleep(ZTIMER_MSEC, SI114X_WAIT_10MS); } void _initialize(si114x_t *dev) diff --git a/drivers/stmpe811/Kconfig b/drivers/stmpe811/Kconfig index 6529d4b564..a7811b41bd 100644 --- a/drivers/stmpe811/Kconfig +++ b/drivers/stmpe811/Kconfig @@ -9,9 +9,12 @@ config MODULE_STMPE811 bool depends on HAS_PERIPH_GPIO depends on HAS_PERIPH_GPIO_IRQ + depends on HAS_PERIPH_I2C + depends on TEST_KCONFIG select MODULE_PERIPH_GPIO select MODULE_PERIPH_GPIO_IRQ - select MODULE_XTIMER + select MODULE_ZTIMER + select MODULE_ZTIMER_MSEC depends on TEST_KCONFIG choice diff --git a/drivers/stmpe811/Makefile.dep b/drivers/stmpe811/Makefile.dep index f6fe18eb00..ea83dde63a 100644 --- a/drivers/stmpe811/Makefile.dep +++ b/drivers/stmpe811/Makefile.dep @@ -8,4 +8,5 @@ ifneq (,$(filter stmpe811_i2c,$(USEMODULE))) FEATURES_REQUIRED += periph_i2c endif -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec diff --git a/drivers/stmpe811/stmpe811.c b/drivers/stmpe811/stmpe811.c index c8d14bc2d2..aab2bde7fc 100644 --- a/drivers/stmpe811/stmpe811.c +++ b/drivers/stmpe811/stmpe811.c @@ -20,7 +20,7 @@ #include -#include "xtimer.h" +#include "ztimer.h" #if IS_USED(MODULE_STMPE811_SPI) #include "periph/spi.h" #else @@ -135,13 +135,13 @@ static int _soft_reset(const stmpe811_t *dev) DEBUG("[stmpe811] soft reset: cannot write soft reset bit to SYS_CTRL1 register\n"); return -EPROTO; } - xtimer_msleep(10); + ztimer_sleep(ZTIMER_MSEC, 10); if (_write_reg(dev, STMPE811_SYS_CTRL1, 0) < 0) { DEBUG("[stmpe811] soft reset: cannot clear SYS_CTRL1 register\n"); return -EPROTO; } - xtimer_msleep(2); + ztimer_sleep(ZTIMER_MSEC, 2); return 0; } 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_ccs811/Makefile b/tests/driver_ccs811/Makefile index 7b7b9b9802..b38053bdd0 100644 --- a/tests/driver_ccs811/Makefile +++ b/tests/driver_ccs811/Makefile @@ -2,4 +2,7 @@ include ../Makefile.tests_common USEMODULE += ccs811 +USEMODULE += ztimer +USEMODULE += ztimer_usec + include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_ccs811/app.config.test b/tests/driver_ccs811/app.config.test index 168cb3ae3b..b952fa3cc3 100644 --- a/tests/driver_ccs811/app.config.test +++ b/tests/driver_ccs811/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_CCS811=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_USEC=y diff --git a/tests/driver_ccs811/main.c b/tests/driver_ccs811/main.c index 2bdb75735b..8f0d6597ff 100644 --- a/tests/driver_ccs811/main.c +++ b/tests/driver_ccs811/main.c @@ -27,7 +27,7 @@ #include #include "thread.h" -#include "xtimer.h" +#include "ztimer.h" #include "ccs811.h" #include "ccs811_params.h" @@ -54,7 +54,7 @@ int main(void) /* wait and check for for new data every 10 ms */ while (ccs811_data_ready (&sensor) != CCS811_OK) { - xtimer_usleep(10000); + ztimer_sleep(ZTIMER_USEC, 10000); } /* read the data and print them on success */ diff --git a/tests/driver_ccs811_full/main.c b/tests/driver_ccs811_full/main.c index face4a4ee8..2f1bfe0082 100644 --- a/tests/driver_ccs811_full/main.c +++ b/tests/driver_ccs811_full/main.c @@ -35,7 +35,6 @@ #include #include "thread.h" -#include "xtimer.h" #include "ccs811.h" #include "ccs811_params.h" diff --git a/tests/driver_lsm6dsl/Makefile b/tests/driver_lsm6dsl/Makefile index 38134d3b89..15da961274 100644 --- a/tests/driver_lsm6dsl/Makefile +++ b/tests/driver_lsm6dsl/Makefile @@ -1,6 +1,7 @@ include ../Makefile.tests_common USEMODULE += lsm6dsl -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_lsm6dsl/app.config.test b/tests/driver_lsm6dsl/app.config.test index 341a6372fd..92570d5912 100644 --- a/tests/driver_lsm6dsl/app.config.test +++ b/tests/driver_lsm6dsl/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_LSM6DSL=y -CONFIG_MODULE_XTIMER=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_MSEC=y diff --git a/tests/driver_lsm6dsl/main.c b/tests/driver_lsm6dsl/main.c index 4ba63cf78b..6daa262a1b 100644 --- a/tests/driver_lsm6dsl/main.c +++ b/tests/driver_lsm6dsl/main.c @@ -22,11 +22,11 @@ #include -#include "xtimer.h" +#include "ztimer.h" #include "lsm6dsl.h" #include "lsm6dsl_params.h" -#define SLEEP_USEC (500UL * US_PER_MS) +#define SLEEP_MSEC (500UL) int main(void) { @@ -55,7 +55,7 @@ int main(void) } puts("[SUCCESS]\n"); - xtimer_sleep(1); + ztimer_sleep(ZTIMER_MSEC, 1 * 1000); puts("Powering up LSM6DSL sensor..."); if (lsm6dsl_acc_power_up(&dev) != LSM6DSL_OK) { @@ -95,7 +95,7 @@ int main(void) } puts(""); - xtimer_usleep(SLEEP_USEC); + ztimer_sleep(ZTIMER_MSEC, SLEEP_MSEC); } return 0; diff --git a/tests/driver_si114x/Makefile b/tests/driver_si114x/Makefile index 2392aab53e..6a83ecc53f 100644 --- a/tests/driver_si114x/Makefile +++ b/tests/driver_si114x/Makefile @@ -1,5 +1,8 @@ include ../Makefile.tests_common +USEMODULE += ztimer +USEMODULE += ztimer_msec + # This test should also work with Si1146 and Si1147 variants. USEMODULE += si1145 diff --git a/tests/driver_si114x/app.config.test b/tests/driver_si114x/app.config.test index bfa15577a7..810a7a6bdb 100644 --- a/tests/driver_si114x/app.config.test +++ b/tests/driver_si114x/app.config.test @@ -1,5 +1,8 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_MSEC=y + # This test should also work with Si1146 and Si1147 variants. CONFIG_MODULE_SI1145=y diff --git a/tests/driver_si114x/main.c b/tests/driver_si114x/main.c index 57dfdf47f8..0c7d4eb8c2 100644 --- a/tests/driver_si114x/main.c +++ b/tests/driver_si114x/main.c @@ -25,7 +25,8 @@ #include "si114x.h" #include "si114x_params.h" -#include "xtimer.h" +#include "timex.h" +#include "ztimer.h" #include "board.h" static si114x_t dev; @@ -63,7 +64,7 @@ int main(void) si114x_read_response(&dev)); /* 2 seconds delay between measures */ - xtimer_sleep(2); + ztimer_sleep(ZTIMER_MSEC, 2 * MS_PER_SEC); } return 0; diff --git a/tests/driver_stmpe811/Makefile.ci b/tests/driver_stmpe811/Makefile.ci new file mode 100644 index 0000000000..b9ff275375 --- /dev/null +++ b/tests/driver_stmpe811/Makefile.ci @@ -0,0 +1,3 @@ +BOARD_INSUFFICIENT_MEMORY := \ + nucleo-l011k4 \ + # 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;