From bb6e6fe30bb61df4765a128c6e776bec15ae0675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Sat, 8 Feb 2025 19:06:37 +0100 Subject: [PATCH] Document std/wasm in embassy-time --- embassy-time/Cargo.toml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml index a25673ef5..7aaae89f9 100644 --- a/embassy-time/Cargo.toml +++ b/embassy-time/Cargo.toml @@ -24,9 +24,6 @@ target = "x86_64-unknown-linux-gnu" features = ["defmt", "std"] [features] -std = ["tick-hz-1_000_000", "critical-section/std", "dep:embassy-time-queue-utils"] -wasm = ["dep:wasm-bindgen", "dep:js-sys", "dep:wasm-timer", "tick-hz-1_000_000", "dep:embassy-time-queue-utils"] - ## Display the time since startup next to defmt log messages. ## At most 1 `defmt-timestamp-uptime-*` feature can be used. ## `defmt-timestamp-uptime` is provided for backwards compatibility (provides the same format as `uptime-us`). @@ -39,8 +36,18 @@ defmt-timestamp-uptime-ts = ["defmt"] defmt-timestamp-uptime-tms = ["defmt"] defmt-timestamp-uptime-tus = ["defmt"] +#! ### Time Drivers + +#! Usually, time drivers are defined by a HAL, or a companion crate to the HAL. For `std` and WASM +#! environments, as well as for testing purposes, `embassy-time` provides some default time drivers +#! that may be suitable for your use case. You can enable one of the following features to use them. + ## Create a `MockDriver` that can be manually advanced for testing purposes. mock-driver = ["tick-hz-1_000_000", "dep:embassy-time-queue-utils"] +## Create a time driver for `std` environments. +std = ["tick-hz-1_000_000", "critical-section/std", "dep:embassy-time-queue-utils"] +## Create a time driver for WASM. +wasm = ["dep:wasm-bindgen", "dep:js-sys", "dep:wasm-timer", "tick-hz-1_000_000", "dep:embassy-time-queue-utils"] #! ### Generic Queue