From cbde66f61049e1753a027665beabeb693ec3aae3 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Fri, 17 Mar 2023 12:04:44 +0100 Subject: [PATCH] sys/trickle: Remove xtimer and only use ztimer --- sys/Makefile.dep | 7 +------ sys/include/trickle.h | 9 --------- sys/trickle/trickle.c | 11 +---------- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 896156eb99..28a256232c 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -225,12 +225,7 @@ endif ifneq (,$(filter trickle,$(USEMODULE))) USEMODULE += random - ifeq (,$(filter ztimer_msec,$(USEMODULE))) - USEMODULE += xtimer - ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) - USEMODULE += ztimer_msec - endif - endif + USEMODULE += ztimer_msec endif ifneq (,$(filter eui_provider,$(USEMODULE))) diff --git a/sys/include/trickle.h b/sys/include/trickle.h index 95cf220872..d001a9c9e7 100644 --- a/sys/include/trickle.h +++ b/sys/include/trickle.h @@ -33,11 +33,7 @@ #endif #include "thread.h" -#if IS_USED(MODULE_ZTIMER_MSEC) #include "ztimer.h" -#else -#include "xtimer.h" -#endif /** * @brief Trickle callback function with arguments @@ -63,13 +59,8 @@ typedef struct { trickle_callback_t callback; /**< callback function and parameter that trickle calls after each interval */ msg_t msg; /**< the msg_t to use for intervals */ -#if IS_USED(MODULE_ZTIMER_MSEC) ztimer_t msg_timer; /**< timer to send a msg_t to the target thread for a new interval */ -#else - xtimer_t msg_timer; /**< xtimer to send a msg_t to the target - thread for a new interval */ -#endif } trickle_t; /** diff --git a/sys/trickle/trickle.c b/sys/trickle/trickle.c index ab37140d10..c6ff5cf15c 100644 --- a/sys/trickle/trickle.c +++ b/sys/trickle/trickle.c @@ -19,6 +19,7 @@ #include "inttypes.h" #include "random.h" #include "trickle.h" +#include "ztimer.h" #define ENABLE_DEBUG 0 #include "debug.h" @@ -53,14 +54,8 @@ void trickle_interval(trickle_t *trickle) /* old_interval == trickle->I / 2 */ trickle->t = random_uint32_range(old_interval, trickle->I); -#if IS_USED(MODULE_ZTIMER_MSEC) ztimer_set_msg(ZTIMER_MSEC, &trickle->msg_timer, (trickle->t + diff), &trickle->msg, trickle->pid); -#else - uint64_t msg_time = (trickle->t + diff) * US_PER_MS; - xtimer_set_msg64(&trickle->msg_timer, msg_time, &trickle->msg, - trickle->pid); -#endif } void trickle_reset_timer(trickle_t *trickle) @@ -93,11 +88,7 @@ void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type, void trickle_stop(trickle_t *trickle) { -#if IS_USED(MODULE_ZTIMER_MSEC) ztimer_remove(ZTIMER_MSEC, &trickle->msg_timer); -#else - xtimer_remove(&trickle->msg_timer); -#endif } void trickle_increment_counter(trickle_t *trickle)