From 57488a57ab1dbfff911b64d8fd128e03ea4914c0 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Mon, 20 Nov 2023 15:16:19 +0100 Subject: [PATCH] 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) --- tests/periph/selftest_shield/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/periph/selftest_shield/main.c b/tests/periph/selftest_shield/main.c index 6352a14391..9cbea56a2b 100644 --- a/tests/periph/selftest_shield/main.c +++ b/tests/periph/selftest_shield/main.c @@ -126,7 +126,17 @@ # define UART_TEST_DEV UART_DEV(0) #endif #ifndef TIMER -# define TIMER TIMER_DEV(0) +# if IS_USED(MODULE_ZTIMER_PERIPH_TIMER) && CONFIG_ZTIMER_USEC_DEV == TIMER_DEV(0) +# define TIMER TIMER_DEV(1) +# else +# define TIMER TIMER_DEV(0) +# endif +#endif + +#if IS_USED(MODULE_ZTIMER_PERIPH_TIMER) +# if CONFIG_ZTIMER_USEC_DEV == TIMER +# error "Same timer used for ztimer and test" +# endif #endif /* A higher clock frequency is beneficial in being able to actually measure the