From a1fe17c698e7c34ba1fe3222b24bfff6427b5702 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 9 Dec 2021 12:48:46 +0100 Subject: [PATCH] drivers/ltc4150: migrate to ztimer64 --- drivers/include/ltc4150.h | 1 - drivers/ltc4150/Kconfig | 2 +- drivers/ltc4150/Makefile.dep | 2 +- drivers/ltc4150/ltc4150.c | 7 ++++--- drivers/ltc4150/ltc4150_last_minute.c | 5 +++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/include/ltc4150.h b/drivers/include/ltc4150.h index 563d61cb7e..24a09740ba 100644 --- a/drivers/include/ltc4150.h +++ b/drivers/include/ltc4150.h @@ -66,7 +66,6 @@ #include "mutex.h" #include "periph/gpio.h" -#include "xtimer.h" #ifdef __cplusplus extern "C" { diff --git a/drivers/ltc4150/Kconfig b/drivers/ltc4150/Kconfig index 977e19ccd0..5ddb9d4590 100644 --- a/drivers/ltc4150/Kconfig +++ b/drivers/ltc4150/Kconfig @@ -12,7 +12,7 @@ config MODULE_LTC4150 depends on TEST_KCONFIG select MODULE_PERIPH_GPIO select MODULE_PERIPH_GPIO_IRQ - select MODULE_XTIMER + select ZTIMER64_USEC help Driver for the Linear Tech LTC4150 Coulomb Counter (a.k.a. battery gauge sensor or power consumption sensor). diff --git a/drivers/ltc4150/Makefile.dep b/drivers/ltc4150/Makefile.dep index 46a195a15d..add2d6c03c 100644 --- a/drivers/ltc4150/Makefile.dep +++ b/drivers/ltc4150/Makefile.dep @@ -1,3 +1,3 @@ FEATURES_REQUIRED += periph_gpio FEATURES_REQUIRED += periph_gpio_irq -USEMODULE += xtimer +USEMODULE += ztimer64_usec diff --git a/drivers/ltc4150/ltc4150.c b/drivers/ltc4150/ltc4150.c index e459767ff1..fa840bab66 100644 --- a/drivers/ltc4150/ltc4150.c +++ b/drivers/ltc4150/ltc4150.c @@ -22,7 +22,8 @@ #include #include "ltc4150.h" -#include "xtimer.h" +#include "ztimer64.h" +#include "timex.h" #define ENABLE_DEBUG 0 #include "debug.h" @@ -44,7 +45,7 @@ static void pulse_cb(void *_dev) dir = LTC4150_CHARGE; } - now = xtimer_now_usec64(); + now = ztimer64_now(ZTIMER64_USEC); if (dev->params.recorders) { assert(dev->params.recorder_data); @@ -101,7 +102,7 @@ int ltc4150_init(ltc4150_dev_t *dev, const ltc4150_params_t *params) int ltc4150_reset_counters(ltc4150_dev_t *dev) { - uint64_t now = xtimer_now_usec64(); + uint64_t now = ztimer64_now(ZTIMER64_USEC); if (!dev) { return -EINVAL; diff --git a/drivers/ltc4150/ltc4150_last_minute.c b/drivers/ltc4150/ltc4150_last_minute.c index 6c068ba3bd..3c77076aea 100644 --- a/drivers/ltc4150/ltc4150_last_minute.c +++ b/drivers/ltc4150/ltc4150_last_minute.c @@ -20,7 +20,8 @@ #include #include "ltc4150.h" -#include "xtimer.h" +#include "ztimer64.h" +#include "timex.h" static void init_or_reset(ltc4150_dev_t *dev, uint64_t now_usec, void *arg); static void pulse(ltc4150_dev_t *dev, ltc4150_dir_t dir, uint64_t now_usec, @@ -87,7 +88,7 @@ int ltc4150_last_minute_charge(ltc4150_dev_t *dev, } gpio_irq_disable(dev->params.interrupt); - update_ringbuffer(d, xtimer_now_usec64()); + update_ringbuffer(d, ztimer64_now(ZTIMER64_USEC)); ltc4150_pulses2c(dev, charged, discharged, d->charged, d->discharged); gpio_irq_enable(dev->params.interrupt);