diff --git a/boards/waspmote-pro/Makefile.dep b/boards/waspmote-pro/Makefile.dep index 1c9242803f..54f2a1d597 100644 --- a/boards/waspmote-pro/Makefile.dep +++ b/boards/waspmote-pro/Makefile.dep @@ -1,3 +1,5 @@ #ifneq (,$(filter saul_default,$(USEMODULE))) # USEMODULE += saul_gpio #endif + +include $(RIOTMAKE)/boards/ztimer_only.dep.mk diff --git a/boards/waspmote-pro/include/board.h b/boards/waspmote-pro/include/board.h index 24bd916769..c014c054ac 100644 --- a/boards/waspmote-pro/include/board.h +++ b/boards/waspmote-pro/include/board.h @@ -159,13 +159,26 @@ extern "C" { /** * @name xtimer configuration values + * @warning This configuration is not actually compatible with xtimer. Sadly, + * no compatible clock frequency can be generated with the given core + * frequency * @{ */ #define XTIMER_WIDTH (16) -#define XTIMER_HZ (62500UL) +#define XTIMER_HZ (230400LU) #define XTIMER_BACKOFF (40) /** @} */ +/** + * @name ztimer configuration values + * @{ + */ +#define CONFIG_ZTIMER_USEC_TYPE ZTIMER_TYPE_PERIPH_TIMER +#define CONFIG_ZTIMER_USEC_DEV (TIMER_DEV(0)) +#define CONFIG_ZTIMER_USEC_FREQ (230400LU) +#define CONFIG_ZTIMER_USEC_WIDTH (16) +/** @} */ + /** * @brief Initialize board specific hardware, including clock, LEDs and std-IO */ diff --git a/makefiles/boards/ztimer_only.dep.mk b/makefiles/boards/ztimer_only.dep.mk new file mode 100644 index 0000000000..f82f98231e --- /dev/null +++ b/makefiles/boards/ztimer_only.dep.mk @@ -0,0 +1,11 @@ +# Include this for boards whose timer periph cannot generate a clock frequency +# suitable for xtimer with the available clock sources and dividers. +# This will use ztimer to perform the required frequency conversion. +# By default, xtimer is still used with ztimer as backed, unless +# ztimer_xtimer_compat is used. + +ifneq (,$(filter xtimer,$(USEMODULE))) + ifeq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + USEMODULE += xtimer_on_ztimer + endif +endif