1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/ltc4150: migrate to ztimer64

This commit is contained in:
Francisco Molina 2021-12-09 12:48:46 +01:00
parent 0398fb3f83
commit a1fe17c698
5 changed files with 9 additions and 8 deletions

View File

@ -66,7 +66,6 @@
#include "mutex.h" #include "mutex.h"
#include "periph/gpio.h" #include "periph/gpio.h"
#include "xtimer.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -12,7 +12,7 @@ config MODULE_LTC4150
depends on TEST_KCONFIG depends on TEST_KCONFIG
select MODULE_PERIPH_GPIO select MODULE_PERIPH_GPIO
select MODULE_PERIPH_GPIO_IRQ select MODULE_PERIPH_GPIO_IRQ
select MODULE_XTIMER select ZTIMER64_USEC
help help
Driver for the Linear Tech LTC4150 Coulomb Counter (a.k.a. battery Driver for the Linear Tech LTC4150 Coulomb Counter (a.k.a. battery
gauge sensor or power consumption sensor). gauge sensor or power consumption sensor).

View File

@ -1,3 +1,3 @@
FEATURES_REQUIRED += periph_gpio FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_gpio_irq FEATURES_REQUIRED += periph_gpio_irq
USEMODULE += xtimer USEMODULE += ztimer64_usec

View File

@ -22,7 +22,8 @@
#include <string.h> #include <string.h>
#include "ltc4150.h" #include "ltc4150.h"
#include "xtimer.h" #include "ztimer64.h"
#include "timex.h"
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
@ -44,7 +45,7 @@ static void pulse_cb(void *_dev)
dir = LTC4150_CHARGE; dir = LTC4150_CHARGE;
} }
now = xtimer_now_usec64(); now = ztimer64_now(ZTIMER64_USEC);
if (dev->params.recorders) { if (dev->params.recorders) {
assert(dev->params.recorder_data); 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) int ltc4150_reset_counters(ltc4150_dev_t *dev)
{ {
uint64_t now = xtimer_now_usec64(); uint64_t now = ztimer64_now(ZTIMER64_USEC);
if (!dev) { if (!dev) {
return -EINVAL; return -EINVAL;

View File

@ -20,7 +20,8 @@
#include <string.h> #include <string.h>
#include "ltc4150.h" #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 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, 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); 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); ltc4150_pulses2c(dev, charged, discharged, d->charged, d->discharged);
gpio_irq_enable(dev->params.interrupt); gpio_irq_enable(dev->params.interrupt);