From d3330e1813e9c53906c8f423f9ed6e43ba9cea5f Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Sun, 2 Jan 2022 07:59:38 +0100 Subject: [PATCH] drivers/cst816s: migrate to ztimer --- drivers/cst816s/Makefile.dep | 3 ++- drivers/cst816s/cst816s.c | 6 +++--- drivers/cst816s/include/cst816s_internal.h | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/cst816s/Makefile.dep b/drivers/cst816s/Makefile.dep index ac9f3060a5..b8ca432d94 100644 --- a/drivers/cst816s/Makefile.dep +++ b/drivers/cst816s/Makefile.dep @@ -1,3 +1,4 @@ FEATURES_REQUIRED += periph_gpio_irq FEATURES_REQUIRED += periph_i2c -USEMODULE += xtimer +USEMODULE += ztimer +USEMODULE += ztimer_msec diff --git a/drivers/cst816s/cst816s.c b/drivers/cst816s/cst816s.c index 6aecd207c2..38a3aab11c 100644 --- a/drivers/cst816s/cst816s.c +++ b/drivers/cst816s/cst816s.c @@ -21,7 +21,7 @@ #include "log.h" #include "periph/gpio.h" #include "periph/i2c.h" -#include "xtimer.h" +#include "ztimer.h" #include "cst816s.h" #include "cst816s_internal.h" @@ -55,9 +55,9 @@ static void _cst816s_reset(const cst816s_t *dev) /* Reset, sleep durations based on * https://github.com/lupyuen/hynitron_i2c_cst0xxse/blob/master/cst0xx_core.c#L1078-L1085 */ gpio_clear(dev->params->reset); - xtimer_usleep(CST816S_RESET_DURATION_LOW); + ztimer_sleep(ZTIMER_MSEC, CST816S_RESET_DURATION_LOW_MS); gpio_set(dev->params->reset); - xtimer_usleep(CST816S_RESET_DURATION_HIGH); + ztimer_sleep(ZTIMER_MSEC, CST816S_RESET_DURATION_HIGH_MS); } int cst816s_read(const cst816s_t *dev, cst816s_touch_data_t *data) diff --git a/drivers/cst816s/include/cst816s_internal.h b/drivers/cst816s/include/cst816s_internal.h index 24dec4886d..bde0bd6650 100644 --- a/drivers/cst816s/include/cst816s_internal.h +++ b/drivers/cst816s/include/cst816s_internal.h @@ -25,8 +25,8 @@ extern "C" { * @name cst816s timing constants * @{ */ -#define CST816S_RESET_DURATION_LOW (20 * US_PER_MS) -#define CST816S_RESET_DURATION_HIGH (400 * US_PER_MS) +#define CST816S_RESET_DURATION_LOW_MS (20) /**< Duration of reset pin low (in ms) */ +#define CST816S_RESET_DURATION_HIGH_MS (400) /**< Duration of reset pin high (in ms) */ /** @} */ #ifdef __cplusplus