Skip to content

Commit

Permalink
tests/periph_timer: Use XTIMER_HZ over manual list
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed Aug 20, 2020
1 parent 6bf6b6b commit 752c6da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 38 deletions.
38 changes: 0 additions & 38 deletions tests/periph_timer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions tests/periph_timer/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <stdint.h>
#include <stdlib.h>

#include "macros/units.h"
#include "periph/timer.h"

/**
Expand All @@ -35,6 +36,14 @@
#define CHAN_OFFSET (5000U) /* fire every 5ms */
#define COOKIE (100U) /* for checking if arg is passed */

#ifndef XTIMER_HZ
#define XTIMER_HZ MHZ(1)
#endif

#ifndef TIMER_SPEED
#define TIMER_SPEED XTIMER_HZ
#endif

static volatile int fired;
static volatile uint32_t sw_count;
static volatile uint32_t timeouts[MAX_CHANNELS];
Expand Down

0 comments on commit 752c6da

Please sign in to comment.