Skip to content

sys/ztimer/xtimer_compat: provide more fallback options#20494

Merged
benpicco merged 2 commits intoRIOT-OS:masterfrom
benpicco:ztimer/xtimer_compat-extend
Dec 15, 2025
Merged

sys/ztimer/xtimer_compat: provide more fallback options#20494
benpicco merged 2 commits intoRIOT-OS:masterfrom
benpicco:ztimer/xtimer_compat-extend

Conversation

@benpicco
Copy link
Copy Markdown
Contributor

@benpicco benpicco commented Mar 20, 2024

Contribution description

The xtimer API can be used as a backend agnostic frontend to ztimer.
To better facilitate this (and also allow the use without a timer for simple sleep operations), add more fall-back implementations.

Testing procedure

Issues/PRs references

alternative to #19719

@benpicco benpicco requested a review from maribu March 20, 2024 15:20
@github-actions github-actions bot added Area: timers Area: timer subsystems Area: sys Area: System labels Mar 20, 2024
@Teufelchen1
Copy link
Copy Markdown
Contributor

Uncrustify is pretty unhappy with this one ;)

@benpicco benpicco force-pushed the ztimer/xtimer_compat-extend branch 2 times, most recently from 0942fbb to 8712ef9 Compare November 15, 2024 16:43
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 15, 2024
@benpicco benpicco force-pushed the ztimer/xtimer_compat-extend branch from 8712ef9 to a5c385a Compare November 15, 2024 16:51
@maribu
Copy link
Copy Markdown
Member

maribu commented Nov 15, 2024

I think the convention was to use IS_USED() with modules. We couod revisit this decision and do an s/IS_USED/IS_ACTIVE/, but rather in a dedicated PR.

We could discuss this in upcoming VMA and quickly vote on this.

@benpicco benpicco force-pushed the ztimer/xtimer_compat-extend branch from a5c385a to 10888b3 Compare November 15, 2024 18:01
@riot-ci
Copy link
Copy Markdown

riot-ci commented Nov 16, 2024

Murdock results

✔️ PASSED

098efc9 ztimer_xtimer_compat: warn if backend != ztimer_usec

Success Failures Total Runtime
10950 0 10950 12m:50s

Artifacts

@kfessel
Copy link
Copy Markdown
Contributor

kfessel commented Nov 18, 2024

I like this (xtimer_compat is a nice interface to ztimer).

I just like to raise the question: "Could we somehow ensure that the user we somehow ensure the user knows about the mapping to ztimer_msec happening?"

  • eg.: simply raise a warning and a pseudo module removes it

@benpicco benpicco force-pushed the ztimer/xtimer_compat-extend branch 2 times, most recently from 78be9db to be2c455 Compare November 18, 2024 13:29
@benpicco
Copy link
Copy Markdown
Contributor Author

What is that warning supposed to look like and what is it supposed to achieve?

The xTimer API is provided by ZTimer. This should have no influence on it's functionality, carry on and have a nice day!

@benpicco benpicco enabled auto-merge November 18, 2024 17:49
@chrysn
Copy link
Copy Markdown
Member

chrysn commented Nov 18, 2024

IIUC this is causing troubles with Rust builds – but riot-wrappers doesn't wrap (and doesn't plan to wrap) XTimer.

Does switching riot-sys in .cargo/config.toml to the branch of RIOT-OS/rust-riot-sys#51 solve the build issues?

@kfessel
Copy link
Copy Markdown
Contributor

kfessel commented Nov 21, 2024

What is that warning supposed to look like and what is it supposed to achieve?

The xTimer API is provided by ZTimer. This should have no influence on it's functionality, carry on and have a nice day!

I thought of a warning in case of ztimer_msec providing the service for xtimer_usleep when it might have some influence on functionality

@benpicco
Copy link
Copy Markdown
Contributor Author

Like so?

@benpicco benpicco requested review from crasbe and fabian18 September 5, 2025 09:31
@crasbe crasbe added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Sep 5, 2025
crasbe
crasbe previously requested changes Sep 5, 2025
@benpicco benpicco force-pushed the ztimer/xtimer_compat-extend branch from 9b93f14 to 5fbd197 Compare December 15, 2025 10:08
@benpicco benpicco force-pushed the ztimer/xtimer_compat-extend branch from 5fbd197 to 098efc9 Compare December 15, 2025 17:08
@benpicco benpicco added this pull request to the merge queue Dec 15, 2025
Merged via the queue into RIOT-OS:master with commit 7275d4b Dec 15, 2025
26 checks passed
@benpicco benpicco deleted the ztimer/xtimer_compat-extend branch December 16, 2025 05:18
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: sys Area: System Area: timers Area: timer subsystems CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants