tests: board specific TIMER_SPEED in periph_timer

By default the periph_timer tests wants to init all timers with 1MHz,
which is not suitable for all timers, e.g. the atmega timers cannot
run at that speed to make the test work they need to be set to 250kHz.
This commit is contained in:
Sebastian Meiling 2018-11-29 16:25:06 +01:00
parent 739cb85830
commit 7913811a0f
2 changed files with 8 additions and 2 deletions

View File

@ -6,4 +6,11 @@ FEATURES_REQUIRED = periph_timer
TEST_ON_CI_WHITELIST += all TEST_ON_CI_WHITELIST += all
ifneq (,$(filter arduino-duemilanove arduino-mega2560 arduino-uno waspmote-pro,$(BOARD)))
TIMER_SPEED ?= 250000
endif
TIMER_SPEED ?= 1000000
CFLAGS += -DTIMER_SPEED=$(TIMER_SPEED)
include $(RIOTBASE)/Makefile.include include $(RIOTBASE)/Makefile.include

View File

@ -32,7 +32,6 @@
#endif #endif
#define MAX_CHANNELS (10U) #define MAX_CHANNELS (10U)
#define TIM_SPEED (1000000ul) /* try to run with 1MHz */
#define CHAN_OFFSET (5000U) /* fire every 5ms */ #define CHAN_OFFSET (5000U) /* fire every 5ms */
#define COOKIE (100U) /* for checking if arg is passed */ #define COOKIE (100U) /* for checking if arg is passed */
@ -61,7 +60,7 @@ static int test_timer(unsigned num)
} }
/* initialize and halt timer */ /* initialize and halt timer */
if (timer_init(TIMER_DEV(num), TIM_SPEED, cb, (void *)(COOKIE * num)) < 0) { if (timer_init(TIMER_DEV(num), TIMER_SPEED, cb, (void *)(COOKIE * num)) < 0) {
printf("TIMER_%u: ERROR on initialization - skipping\n\n", num); printf("TIMER_%u: ERROR on initialization - skipping\n\n", num);
return 0; return 0;
} }