1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

drivers/sht2x: migration to ztimer

This commit is contained in:
Gunar Schorcht 2022-12-13 00:51:51 +01:00
parent 268e931f1c
commit 8a605517f5
3 changed files with 8 additions and 7 deletions

View File

@ -10,7 +10,7 @@ config MODULE_SHT2X
depends on HAS_PERIPH_I2C
depends on TEST_KCONFIG
select MODULE_PERIPH_I2C
select MODULE_XTIMER
select MODULE_ZTIMER_MSEC
config HAVE_SHT2X
bool

View File

@ -1,2 +1,2 @@
USEMODULE += xtimer
USEMODULE += ztimer_msec
FEATURES_REQUIRED += periph_i2c

View File

@ -26,10 +26,11 @@
#include <math.h>
#include "log.h"
#include "periph/i2c.h"
#include "ztimer.h"
#include "sht2x.h"
#include "sht2x_params.h"
#include "periph/i2c.h"
#include "xtimer.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -93,7 +94,7 @@ int sht2x_init(sht2x_t* dev, const sht2x_params_t* params)
return SHT2X_ERR_I2C;
}
/* wait 15 ms for device to reset */
xtimer_msleep(15);
ztimer_sleep(ZTIMER_MSEC, 15);
uint8_t userreg;
uint8_t userreg2;
@ -450,7 +451,7 @@ static void sleep_during_temp_measurement(sht2x_res_t res)
amount_ms = 9;
break;
}
xtimer_msleep(amount_ms);
ztimer_sleep(ZTIMER_MSEC, amount_ms);
}
static void sleep_during_hum_measurement(sht2x_res_t resolution)
@ -471,5 +472,5 @@ static void sleep_during_hum_measurement(sht2x_res_t resolution)
amount_ms = 12;
break;
}
xtimer_msleep(amount_ms);
ztimer_sleep(ZTIMER_MSEC, amount_ms);
}