-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ztimer with two instances of ztimer_periph_timer #17611
Comments
Would it be possible to provide letimer as an alternative rtt (if someone uses radio)? |
I'm not a fan of weak symbols, people get surprised often by functions being overridden in the linking step. |
I guess. But I don't like to go that way -
Thank you for your advise! Yes, xfa based |
If it turns out that initializing the ztimer during the auto_init phase is necessary (say, because a later auto_init'ed driver needs it running), there would still be the option of putting the auto initialization into auto init with a board-selective (or, efm32-common selective, or even more precisely named like auto_init_ztimer_efm32mixed) guard into the auto init section. (A precisely named (pseudo)module for this would also allow users who disable the auto_init_ztimer module to disable auto_init_ztimer_efm32mixed, though I doubt there are good reasons to disable ztimer auto init unless one provides equivalent functionality as proposed here. If it does turn out to be relevant, the current auto_init_ztimer could still be renamed to auto_init_ztimer_default, and auto_init_ztimer becomes a pseudomodule like netdev_default that just selects whatever is the default ztimer setup for that board -- but as said, likely not necesary). |
It would also be possible to add a second timer to the ztimer auto config -> |
I think that's what jue's "2. Somehow bring this combination into the current ztimer_init()" meant, which would add complexity to an already complex setup. |
In the first attempt, I try not to mix-in too much EFM32 Series 2 related stuff into the core and auto_init system. I'd say reviewing initial patches for a new cpu family is a time-intensive task, anyway. Thus, I try to allow reviewers to convince themselves that no other parts of RIOT are touched and side-effects aren't to be expected.
Integrating and generalizing stuff (as #17654 proposes) should be the second step after the family has landed in RIOT. |
Description
I'm using
ztimer
on theefm32
family. This family has two different types ofperiph_timer
: One which makes use of the EFM32 TIMER peripheral and one that utilizes the EFM32 LETIMER peripheral. The latter one may be clocked by a low-frequency crystal and stays active during lower power modes.I'd like to use a LETIMER for the
ZTIMER_MSEC
and one TIMER for theZTIMER_USEC
. This combination isn't supported byztimer_init
. (I have reasons for not usingperiph_rtt
: it conflicts with the internal radio in my case.) I see two different options for this:ztimer_init()
weak and provide an ownztimer_init()
for the EFM32 family.ztimer_init()
I'd say the first option is the better one. The current
ztimer_init()
implementation is already very complex. I'd say introducing more complexity for this corner case isn't worth it.What do you think?
Useful links
periph_timer
implementation for the EFM32 familyperiph_conf.h
of theikea-tradfri
board that would benefit from this patch.The text was updated successfully, but these errors were encountered: