From 84f49bb4c895b3ff15891cad522e10f9627e9a11 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 20 Aug 2020 07:15:59 +0200 Subject: [PATCH 1/2] tests/periph_timer_short_relative_set: Don't include xtimer.h Including xtimer.h without using the xtimer module results in issues on the waspmote-pro. Thus, drop the include. --- tests/periph_timer_short_relative_set/main.c | 31 +++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/periph_timer_short_relative_set/main.c b/tests/periph_timer_short_relative_set/main.c index d5c7b3a471..556d782a35 100644 --- a/tests/periph_timer_short_relative_set/main.c +++ b/tests/periph_timer_short_relative_set/main.c @@ -23,20 +23,35 @@ #include #include "board.h" +#include "macros/units.h" #include "thread.h" #include "thread_flags.h" #include "periph/timer.h" -#ifndef TEST_TIMER_DEV -# include "xtimer.h" -# define TEST_TIMER_DEV XTIMER_DEV -# define TEST_TIMER_FREQ XTIMER_HZ -# define TEST_TIMER_WIDTH XTIMER_WIDTH -#else -# ifndef TEST_TIMER_FREQ -# define TEST_TIMER_FREQ (1000000LU) +/* recreate logic to obtain valid XTIMER_DEV used in xtimer.h, but don't include + * xtimer.h, as this leads to issues on some boards when the xtimer module is + * not used */ +#ifndef XTIMER_DEV +# define XTIMER_DEV TIMER_DEV(0) +#endif +#ifndef XTIMER_HZ +# define XTIMER_HZ MHZ(1) +#endif +#ifndef XTIMER_WIDTH +# if(TIMER_0_MAX_VALUE) == 0xfffffful +# define XTIMER_WIDTH (24) +# elif (TIMER_0_MAX_VALUE) == 0xffff +# define XTIMER_WIDTH (16) +# else +# define XTIMER_WIDTH (32) # endif +#endif /* !defined(XTIMER_WIDTH) */ + +#ifndef TEST_TIMER_FREQ +# define TEST_TIMER_DEV XTIMER_DEV +# define TEST_TIMER_FREQ XTIMER_HZ +# define TEST_TIMER_WIDTH XTIMER_WIDTH #endif #ifndef TEST_MAX_DIFF From 39ae9ec399caf9dad59439edee81066094aa50d2 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 20 Aug 2020 07:14:59 +0200 Subject: [PATCH 2/2] tests/periph_timer_periodic: Don't include xtimer.h Including xtimer.h without using the xtimer module results in issues on the waspmote-pro. Thus, drop the include. --- tests/periph_timer_periodic/main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/periph_timer_periodic/main.c b/tests/periph_timer_periodic/main.c index 640b057a80..92461b8a07 100644 --- a/tests/periph_timer_periodic/main.c +++ b/tests/periph_timer_periodic/main.c @@ -22,11 +22,20 @@ #include #include "board.h" -#include "test_utils/expect.h" - +#include "macros/units.h" #include "mutex.h" #include "periph/timer.h" -#include "xtimer.h" +#include "test_utils/expect.h" + +/* recreate logic to obtain valid XTIMER_DEV used in xtimer.h, but don't include + * xtimer.h, as this leads to issues on some boards when the xtimer module is + * not used */ +#ifndef XTIMER_DEV +#define XTIMER_DEV TIMER_DEV(0) +#endif +#ifndef XTIMER_HZ +#define XTIMER_HZ MHZ(1) +#endif /* We use the timer used for xtimer with the frequency used by xtimer here * to make sure we have a known valid timer configuration.