From daae2fb9bd8c6ec969ce2ae142dd56e230566a37 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 4 Nov 2020 23:00:49 +0100 Subject: [PATCH] drivers/mhz19: convert to xtimer_msleep() --- drivers/mhz19/mhz19_pwm.c | 8 ++++---- drivers/mhz19/mhz19_uart.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mhz19/mhz19_pwm.c b/drivers/mhz19/mhz19_pwm.c index 7cf3faabf1..34a0fb4bc4 100644 --- a/drivers/mhz19/mhz19_pwm.c +++ b/drivers/mhz19/mhz19_pwm.c @@ -61,26 +61,26 @@ int mhz19_get_ppm(mhz19_t *dev, int16_t *ppm) DEBUG("%s: Waiting for high level to end\n", __func__); while (gpio_read(dev->pin) && timeout) { timeout--; - xtimer_usleep(US_PER_MS); + xtimer_msleep(1); } DEBUG("%s: Waiting for initial rising edge\n", __func__); while (!gpio_read(dev->pin) && timeout) { timeout--; - xtimer_usleep(US_PER_MS); + xtimer_msleep(1); } start = xtimer_now_usec() / US_PER_MS; DEBUG("%s: Waiting for falling edge\n", __func__); while (gpio_read(dev->pin) && timeout) { timeout--; - xtimer_usleep(US_PER_MS); + xtimer_msleep(1); } middle = xtimer_now_usec() / US_PER_MS; DEBUG("%s: Waiting for rising edge\n", __func__); while (!gpio_read(dev->pin) && timeout) { timeout--; - xtimer_usleep(US_PER_MS); + xtimer_msleep(1); } /* If we waited too long for flanks, something went wrong */ diff --git a/drivers/mhz19/mhz19_uart.c b/drivers/mhz19/mhz19_uart.c index e43dc321c8..887bb2b778 100644 --- a/drivers/mhz19/mhz19_uart.c +++ b/drivers/mhz19/mhz19_uart.c @@ -137,7 +137,7 @@ static void mhz19_cmd(mhz19_t *dev, const uint8_t *in) uart_write(dev->params->uart, in, MHZ19_BUF_SIZE + 1); /* Add some delay after executing command */ - xtimer_usleep(MHZ19_TIMEOUT_CMD * US_PER_MS); + xtimer_msleep(MHZ19_TIMEOUT_CMD); /* Unlock concurrency guard mutex */ mutex_unlock(&dev->mutex);