diff --git a/tests/periph_timer/Makefile b/tests/periph_timer/Makefile index d86e686a82f8e..65f5811f9c9bd 100644 --- a/tests/periph_timer/Makefile +++ b/tests/periph_timer/Makefile @@ -2,42 +2,4 @@ include ../Makefile.tests_common FEATURES_REQUIRED = periph_timer -BOARDS_TIMER_25kHz := \ - arduino-duemilanove \ - arduino-leonardo \ - arduino-mega2560 \ - arduino-uno \ - atmega256rfr2-xpro \ - atmega328p \ - waspmote-pro \ - # - -BOARDS_TIMER_32kHz := \ - hifive1 \ - hifive1b \ - %-kw41z \ - openlabs-kw41z-mini \ - frdm-k64f \ - frdm-k22f \ - # - -BOARDS_TIMER_CLOCK_CORECLOCK := \ - cc2538dk \ - openmote-b \ - openmote-cc2538 \ - remote-reva \ - remote-revb \ - # - -ifneq (,$(filter $(BOARDS_TIMER_25kHz),$(BOARD))) - TIMER_SPEED ?= 250000 -else ifneq (,$(filter $(BOARDS_TIMER_32kHz),$(BOARD))) - TIMER_SPEED ?= 32768 -else ifneq (,$(filter $(BOARDS_TIMER_CLOCK_CORECLOCK),$(BOARD))) - TIMER_SPEED ?= CLOCK_CORECLOCK -endif - -TIMER_SPEED ?= 1000000 - -CFLAGS += -DTIMER_SPEED=$(TIMER_SPEED) include $(RIOTBASE)/Makefile.include diff --git a/tests/periph_timer/main.c b/tests/periph_timer/main.c index 1cd0a9e39beae..e2dbaefd415c8 100644 --- a/tests/periph_timer/main.c +++ b/tests/periph_timer/main.c @@ -22,6 +22,7 @@ #include #include +#include "macros/units.h" #include "periph/timer.h" /** @@ -35,10 +36,18 @@ #define CHAN_OFFSET (5000U) /* fire every 5ms */ #define COOKIE (100U) /* for checking if arg is passed */ -static volatile int fired; -static volatile uint32_t sw_count; -static volatile uint32_t timeouts[MAX_CHANNELS]; -static volatile unsigned args[MAX_CHANNELS]; +#ifndef XTIMER_HZ +#define XTIMER_HZ MHZ(1) +#endif + +#ifndef TIMER_SPEED +#define TIMER_SPEED XTIMER_HZ +#endif + +static int fired; +static uint32_t sw_count; +static uint32_t timeouts[MAX_CHANNELS]; +static unsigned args[MAX_CHANNELS]; static void cb(void *arg, int chan) {