RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

sys/ztimer/xtimer_compat: provide more fallback options

Open benpicco opened this issue 1 year ago • 8 comments

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 avatar Mar 20 '24 15:03 benpicco

Uncrustify is pretty unhappy with this one ;)

Teufelchen1 avatar Mar 25 '24 10:03 Teufelchen1

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.

maribu avatar Nov 15 '24 17:11 maribu

Murdock results

:x: FAILED

9b93f14963bc066d1c71bfb6b23f304ae7f74f6d fixup! fixup! fixup! Update sys/include/ztimer/xtimer_compat.h

Success Failures Total Runtime
10515 0 10873 08m:03s

Artifacts

riot-ci avatar Nov 16 '24 01:11 riot-ci

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

kfessel avatar Nov 18 '24 09:11 kfessel

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 avatar Nov 18 '24 15:11 benpicco

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 https://github.com/RIOT-OS/rust-riot-sys/pull/51 solve the build issues?

chrysn avatar Nov 18 '24 20:11 chrysn

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

kfessel avatar Nov 21 '24 14:11 kfessel

Like so?

benpicco avatar Nov 21 '24 15:11 benpicco