boards/waspmote: Fix timer config

- Set XTIMER_HZ to something that is actually possible to generate with one
  of the available clock dividers from the core frequency
- Use xtimer_on_ztimer if xtimer is used and not ztimer_xtimer_compat is used
    - This is needed because xtimer is simply not compatible with any of the
      possible clock frequencies of this board
This commit is contained in:
Marian Buschsieweke 2020-08-19 21:19:51 +02:00
parent e719eaf97c
commit d5c0e30a11
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
3 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,5 @@
#ifneq (,$(filter saul_default,$(USEMODULE))) #ifneq (,$(filter saul_default,$(USEMODULE)))
# USEMODULE += saul_gpio # USEMODULE += saul_gpio
#endif #endif
include $(RIOTMAKE)/boards/ztimer_only.dep.mk

View File

@ -159,13 +159,26 @@ extern "C" {
/** /**
* @name xtimer configuration values * @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_WIDTH (16)
#define XTIMER_HZ (62500UL) #define XTIMER_HZ (230400LU)
#define XTIMER_BACKOFF (40) #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 * @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/ */

View File

@ -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