From 17ca5db1f571d96403bb63687671be7c21295169 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Mon, 22 May 2023 13:27:44 +0200 Subject: [PATCH] sys/isrpipe: Replace xtimer with ztimer_usec --- sys/Makefile.dep | 2 +- sys/isrpipe/Kconfig | 2 +- sys/isrpipe/read_timeout/read_timeout.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/Makefile.dep b/sys/Makefile.dep index b8a0dd8b11..e10ee3a8f4 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -362,7 +362,7 @@ endif ifneq (,$(filter isrpipe_read_timeout,$(USEMODULE))) USEMODULE += isrpipe - USEMODULE += xtimer + USEMODULE += ztimer_usec endif ifneq (,$(filter md5sum sha1sum sha256sum,$(USEMODULE))) diff --git a/sys/isrpipe/Kconfig b/sys/isrpipe/Kconfig index 6519d4e328..af253a500f 100644 --- a/sys/isrpipe/Kconfig +++ b/sys/isrpipe/Kconfig @@ -15,4 +15,4 @@ menuconfig MODULE_ISRPIPE config MODULE_ISRPIPE_READ_TIMEOUT bool "ISR Pipe read with timeout" depends on MODULE_ISRPIPE - select MODULE_XTIMER + select ZTIMER_USEC diff --git a/sys/isrpipe/read_timeout/read_timeout.c b/sys/isrpipe/read_timeout/read_timeout.c index 95f9c83f2e..3a5c6b98a0 100644 --- a/sys/isrpipe/read_timeout/read_timeout.c +++ b/sys/isrpipe/read_timeout/read_timeout.c @@ -20,7 +20,7 @@ #include #include "isrpipe/read_timeout.h" -#include "xtimer.h" +#include "ztimer.h" typedef struct { mutex_t *mutex; @@ -41,9 +41,9 @@ int isrpipe_read_timeout(isrpipe_t *isrpipe, uint8_t *buffer, size_t count, uint _isrpipe_timeout_t _timeout = { .mutex = &isrpipe->mutex, .flag = 0 }; - xtimer_t timer = { .callback = _cb, .arg = &_timeout }; + ztimer_t timer = { .callback = _cb, .arg = &_timeout }; - xtimer_set(&timer, timeout); + ztimer_set(ZTIMER_USEC, &timer, timeout); while (!(res = tsrb_get(&isrpipe->tsrb, buffer, count))) { mutex_lock(&isrpipe->mutex); if (_timeout.flag) { @@ -52,7 +52,7 @@ int isrpipe_read_timeout(isrpipe_t *isrpipe, uint8_t *buffer, size_t count, uint } } - xtimer_remove(&timer); + ztimer_remove(ZTIMER_USEC, &timer); return res; }