mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/mhz19: convert to xtimer_msleep()
This commit is contained in:
parent
30e7b6da74
commit
daae2fb9bd
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user