mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/si70xx: migrate to ztimer
This commit is contained in:
parent
3bdb2e8053
commit
f4474ed817
@ -10,7 +10,8 @@ config MODULE_SI70XX
|
||||
depends on TEST_KCONFIG
|
||||
depends on HAS_PERIPH_I2C
|
||||
select MODULE_PERIPH_I2C
|
||||
select MODULE_XTIMER
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_MSEC
|
||||
|
||||
choice
|
||||
bool "Sensor variant"
|
||||
@ -56,4 +57,4 @@ config HAVE_SI7021
|
||||
bool
|
||||
select MODULE_SI70XX if MODULE_SAUL_DEFAULT
|
||||
help
|
||||
Indicates that a si7021 sensor is present.
|
||||
Indicates that a si7021 sensor is present.
|
||||
|
@ -1,2 +1,3 @@
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
FEATURES_REQUIRED += periph_i2c
|
||||
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#include "si70xx_internals.h"
|
||||
#include "si70xx.h"
|
||||
@ -162,7 +162,7 @@ int si70xx_init(si70xx_t *dev, const si70xx_params_t *params)
|
||||
i2c_release(SI70XX_I2C);
|
||||
|
||||
/* sensor is ready after at most 25 ms */
|
||||
xtimer_msleep(25);
|
||||
ztimer_sleep(ZTIMER_MSEC, 25);
|
||||
|
||||
DEBUG("[DEBUG] Device initialized with success.\n");
|
||||
return SI70XX_OK;
|
||||
|
@ -5,4 +5,7 @@ SI70XX_VARIANT ?= si7021
|
||||
|
||||
USEMODULE += $(SI70XX_VARIANT)
|
||||
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -4,3 +4,6 @@
|
||||
# This test should also work with Si7006, Si7013 and Si7020 variants.
|
||||
CONFIG_MODULE_SI70XX=y
|
||||
CONFIG_MODULE_SI7021=y
|
||||
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#include "si70xx_params.h"
|
||||
#include "si70xx.h"
|
||||
@ -74,7 +75,7 @@ int main(void)
|
||||
temperature % 100);
|
||||
|
||||
/* sleep between measurements */
|
||||
xtimer_msleep(1000);
|
||||
ztimer_sleep(ZTIMER_MSEC, MS_PER_SEC); /* 1s delay */
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user