Skip to content

Commit 57488a5

Browse files
committed
tests/periph/selftest_shield: timer allocation conflict
- Detect when the same timer is used by `ztimer` (pulled in as dependency for a peripheral driver, e.g. `periph_adc` on STM32F3) and the test application - Try to provide a better default (e.g. `TIMER_DEV(1)` when `ztimer_periph_timer` is in use, `TIMER_DEV(0)` otherwise)
1 parent e51dc09 commit 57488a5

File tree

1 file changed

+11
-1
lines changed
  • tests/periph/selftest_shield

1 file changed

+11
-1
lines changed

tests/periph/selftest_shield/main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,17 @@
126126
# define UART_TEST_DEV UART_DEV(0)
127127
#endif
128128
#ifndef TIMER
129-
# define TIMER TIMER_DEV(0)
129+
# if IS_USED(MODULE_ZTIMER_PERIPH_TIMER) && CONFIG_ZTIMER_USEC_DEV == TIMER_DEV(0)
130+
# define TIMER TIMER_DEV(1)
131+
# else
132+
# define TIMER TIMER_DEV(0)
133+
# endif
134+
#endif
135+
136+
#if IS_USED(MODULE_ZTIMER_PERIPH_TIMER)
137+
# if CONFIG_ZTIMER_USEC_DEV == TIMER
138+
# error "Same timer used for ztimer and test"
139+
# endif
130140
#endif
131141

132142
/* A higher clock frequency is beneficial in being able to actually measure the

0 commit comments

Comments
 (0)