From 5205151876c8762ee93e4f3585baa1530829aa1d Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Tue, 14 Mar 2023 18:13:09 +0100 Subject: [PATCH 1/2] cord: convert to ztimer --- sys/Makefile.dep | 2 +- sys/net/application_layer/cord/ep/cord_ep_standalone.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 739b844c15ad3..896156eb99f0f 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -810,7 +810,7 @@ endif ifneq (,$(filter cord_ep_standalone,$(USEMODULE))) USEMODULE += cord_ep - USEMODULE += xtimer + USEMODULE += ztimer_msec endif ifneq (,$(filter cord_lc,$(USEMODULE))) diff --git a/sys/net/application_layer/cord/ep/cord_ep_standalone.c b/sys/net/application_layer/cord/ep/cord_ep_standalone.c index c671db3941419..bbdc3650f2330 100644 --- a/sys/net/application_layer/cord/ep/cord_ep_standalone.c +++ b/sys/net/application_layer/cord/ep/cord_ep_standalone.c @@ -23,7 +23,7 @@ #include "log.h" #include "assert.h" #include "thread.h" -#include "xtimer.h" +#include "ztimer.h" #include "net/cord/ep.h" #include "net/cord/config.h" #include "net/cord/ep_standalone.h" @@ -38,11 +38,11 @@ #define UPDATE_TIMEOUT (0xe537) -#define TIMEOUT_US ((uint64_t)(CONFIG_CORD_UPDATE_INTERVAL * US_PER_SEC)) +#define TIMEOUT_MS (CONFIG_CORD_UPDATE_INTERVAL * MS_PER_SEC) static char _stack[STACKSIZE]; -static xtimer_t _timer; +static ztimer_t _timer; static kernel_pid_t _runner_pid; static msg_t _msg; @@ -50,7 +50,7 @@ static cord_ep_standalone_cb_t _cb = NULL; static void _set_timer(void) { - xtimer_set_msg64(&_timer, TIMEOUT_US, &_msg, _runner_pid); + ztimer_set_msg(ZTIMER_MSEC, &_timer, TIMEOUT_MS, &_msg, _runner_pid); } static void _notify(cord_ep_standalone_event_t event) @@ -94,7 +94,7 @@ void cord_ep_standalone_run(void) void cord_ep_standalone_signal(bool connected) { /* clear timer in any case */ - xtimer_remove(&_timer); + ztimer_remove(ZTIMER_MSEC, &_timer); /* reset the update timer in case a connection was established or updated */ if (connected) { _set_timer(); From fa0ab40920c154fad37685032279ff80c3d256d0 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Tue, 14 Mar 2023 18:16:47 +0100 Subject: [PATCH 2/2] ztimer: Fix doc on ztimer_remove --- sys/include/ztimer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/include/ztimer.h b/sys/include/ztimer.h index 30b9428532548..a59201614c5dd 100644 --- a/sys/include/ztimer.h +++ b/sys/include/ztimer.h @@ -487,7 +487,7 @@ unsigned ztimer_is_set(const ztimer_clock_t *clock, const ztimer_t *timer); /** * @brief Remove a timer from a clock * - * This will place @p timer in the timer targets queue for @p clock. + * This will remove @p timer from the timer targets queue for @p clock. * * This function does nothing if @p timer is not found in the timer queue of * @p clock.