drivers/ad7746: migrate to ztimer
This commit is contained in:
parent
85313ccc02
commit
9d53ed3ebf
@ -10,5 +10,7 @@ config MODULE_AD7746
|
||||
depends on HAS_PERIPH_I2C
|
||||
depends on TEST_KCONFIG
|
||||
select MODULE_PERIPH_I2C
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_MSEC
|
||||
help
|
||||
AD7746 Capacitance-to-digital converter with temperature sensor driver.
|
||||
|
||||
@ -1 +1,3 @@
|
||||
FEATURES_REQUIRED += periph_i2c
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "ztimer.h"
|
||||
|
||||
#include "ad7746.h"
|
||||
#include "ad7746_params.h"
|
||||
#include "ad7746_internal.h"
|
||||
@ -30,8 +32,6 @@
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#include "xtimer.h"
|
||||
|
||||
#define DEV (dev->params.i2c)
|
||||
#define ADDR (dev->params.addr)
|
||||
|
||||
@ -382,7 +382,7 @@ static int _read_voltage_temp(ad7746_t *dev, int *value, ad7746_vt_mode_t mode)
|
||||
/* if a mode change is needed wait for a conversion cycle and flush
|
||||
* the first sample in order to get a stable output. Took from the Linux
|
||||
* driver implementation */
|
||||
xtimer_msleep(_vt_sr_times[dev->params.vt_sample_rate]);
|
||||
ztimer_sleep(ZTIMER_MSEC, _vt_sr_times[dev->params.vt_sample_rate]);
|
||||
_read_raw_ch(dev, AD7746_READ_VT_CH, &raw);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += ad7746
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
# this file enables modules defined in Kconfig. Do not use this file for
|
||||
# application configuration. This is only needed during migration.
|
||||
CONFIG_MODULE_AD7746=y
|
||||
CONFIG_MODULE_XTIMER=y
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
||||
|
||||
@ -20,12 +20,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
#include "timex.h"
|
||||
#include "ad7746.h"
|
||||
#include "ad7746_params.h"
|
||||
|
||||
#define SLEEP_USEC (1000 * US_PER_MS)
|
||||
#define SLEEP_MS (MS_PER_SEC)
|
||||
|
||||
static ad7746_t dev;
|
||||
|
||||
@ -84,7 +84,7 @@ int main(void)
|
||||
printf("Error reading internal temperature\n");
|
||||
}
|
||||
puts("");
|
||||
xtimer_usleep(SLEEP_USEC);
|
||||
ztimer_sleep(ZTIMER_MSEC, SLEEP_MS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user