diff --git a/drivers/bmp180/Kconfig b/drivers/bmp180/Kconfig index b3b9bb2a87..110993d6db 100644 --- a/drivers/bmp180/Kconfig +++ b/drivers/bmp180/Kconfig @@ -10,4 +10,5 @@ config MODULE_BMP180 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/bmp180/Makefile.dep b/drivers/bmp180/Makefile.dep index 9508a8aff7..40e4e2276c 100644 --- a/drivers/bmp180/Makefile.dep +++ b/drivers/bmp180/Makefile.dep @@ -1,2 +1,3 @@ FEATURES_REQUIRED += periph_i2c -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec diff --git a/drivers/bmp180/bmp180.c b/drivers/bmp180/bmp180.c index 041813914a..337cbad1a6 100644 --- a/drivers/bmp180/bmp180.c +++ b/drivers/bmp180/bmp180.c @@ -25,7 +25,7 @@ #include "bmp180_internals.h" #include "bmp180_params.h" #include "periph/i2c.h" -#include "xtimer.h" +#include "ztimer.h" #define ENABLE_DEBUG 0 #include "debug.h" @@ -65,7 +65,7 @@ int bmp180_init(bmp180_t *dev, const bmp180_params_t *params) } /* adding delay before reading calibration values to avoid timing issues */ - xtimer_usleep(BMP180_ULTRALOWPOWER_DELAY); + ztimer_sleep(ZTIMER_MSEC, BMP180_ULTRALOWPOWER_DELAY_MS); uint8_t buffer[22] = {0}; /* Read calibration values, using contiguous register addresses */ @@ -187,7 +187,7 @@ static int _read_ut(const bmp180_t *dev, int32_t *output) uint8_t ut[2] = {0}; uint8_t control[2] = { BMP180_REGISTER_CONTROL, BMP180_TEMPERATURE_COMMAND }; i2c_write_bytes(DEV_I2C, DEV_ADDR, control, 2, 0); - xtimer_usleep(BMP180_ULTRALOWPOWER_DELAY); + ztimer_sleep(ZTIMER_MSEC, BMP180_ULTRALOWPOWER_DELAY_MS); if (i2c_read_regs(DEV_I2C, DEV_ADDR, BMP180_REGISTER_DATA, ut, 2, 0) < 0) { DEBUG("[Error] Cannot read uncompensated temperature.\n"); i2c_release(DEV_I2C); @@ -209,19 +209,19 @@ static int _read_up(const bmp180_t *dev, int32_t *output) i2c_write_bytes(DEV_I2C, DEV_ADDR, control, 2, 0); switch (OVERSAMPLING) { case BMP180_ULTRALOWPOWER: - xtimer_usleep(BMP180_ULTRALOWPOWER_DELAY); + ztimer_sleep(ZTIMER_MSEC, BMP180_ULTRALOWPOWER_DELAY_MS); break; case BMP180_STANDARD: - xtimer_usleep(BMP180_STANDARD_DELAY); + ztimer_sleep(ZTIMER_MSEC, BMP180_STANDARD_DELAY_MS); break; case BMP180_HIGHRES: - xtimer_usleep(BMP180_HIGHRES_DELAY); + ztimer_sleep(ZTIMER_MSEC, BMP180_HIGHRES_DELAY_MS); break; case BMP180_ULTRAHIGHRES: - xtimer_usleep(BMP180_ULTRAHIGHRES_DELAY); + ztimer_sleep(ZTIMER_MSEC, BMP180_ULTRAHIGHRES_DELAY_MS); break; default: - xtimer_usleep(BMP180_ULTRALOWPOWER_DELAY); + ztimer_sleep(ZTIMER_MSEC, BMP180_ULTRALOWPOWER_DELAY_MS); break; } if (i2c_read_regs(DEV_I2C, DEV_ADDR, BMP180_REGISTER_DATA, up, 3, 0) < 0) { diff --git a/drivers/bmp180/bmp180_saul.c b/drivers/bmp180/bmp180_saul.c index 7a5076d44f..fe82a4baf6 100644 --- a/drivers/bmp180/bmp180_saul.c +++ b/drivers/bmp180/bmp180_saul.c @@ -23,7 +23,6 @@ #include "saul.h" #include "bmp180.h" -#include "xtimer.h" static int read_temperature(const void *dev, phydat_t *res) { diff --git a/drivers/bmp180/include/bmp180_internals.h b/drivers/bmp180/include/bmp180_internals.h index 5fd8007765..768f459f4f 100644 --- a/drivers/bmp180/include/bmp180_internals.h +++ b/drivers/bmp180/include/bmp180_internals.h @@ -47,10 +47,10 @@ extern "C" { * @name Oversampling modes delays (micros) * @{ */ -#define BMP180_ULTRALOWPOWER_DELAY (5000UL) -#define BMP180_STANDARD_DELAY (8000UL) -#define BMP180_HIGHRES_DELAY (14000UL) -#define BMP180_ULTRAHIGHRES_DELAY (26000UL) +#define BMP180_ULTRALOWPOWER_DELAY_MS (5UL) /**< Ultra low power delay (ms) */ +#define BMP180_STANDARD_DELAY_MS (8UL) /**< Standard resolution delay (ms) */ +#define BMP180_HIGHRES_DELAY_MS (14UL) /**< High resolution delay (ms) */ +#define BMP180_ULTRAHIGHRES_DELAY_MS (26UL) /**< Ultra high resolution delay (ms) */ /** @} */ #ifdef __cplusplus