From 57f2bd9934a0d8ff02c041ac3f063ea38a3e6f5a Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Tue, 22 Sep 2020 22:34:55 +0200 Subject: [PATCH] tests/periph_timer_periodic: Use fmt for in-irq printing This replaces the printf statement in the timer callback with fmt-based printing and a single puts. This is less heavy on the stack usage than printf, making this test a bit easier to digest on the smaller platforms. --- tests/periph_timer_periodic/Makefile | 2 ++ tests/periph_timer_periodic/main.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/periph_timer_periodic/Makefile b/tests/periph_timer_periodic/Makefile index f3bc668f72..b756db5c95 100644 --- a/tests/periph_timer_periodic/Makefile +++ b/tests/periph_timer_periodic/Makefile @@ -2,4 +2,6 @@ include ../Makefile.tests_common FEATURES_REQUIRED = periph_timer_periodic +USEMODULE += fmt + include $(RIOTBASE)/Makefile.include diff --git a/tests/periph_timer_periodic/main.c b/tests/periph_timer_periodic/main.c index 92461b8a07..2f3be4830b 100644 --- a/tests/periph_timer_periodic/main.c +++ b/tests/periph_timer_periodic/main.c @@ -23,6 +23,8 @@ #include "board.h" #include "macros/units.h" + +#include "fmt.h" #include "mutex.h" #include "periph/timer.h" #include "test_utils/expect.h" @@ -61,7 +63,9 @@ static void cb(void *arg, int chan) { unsigned c = count[chan]++; - printf("[%d] tick\n", chan); + print_str("["); + print_u32_dec(chan); + print_str("] tick\n"); if (c > CYCLES_MAX) { timer_stop(TIMER_CYCL);