From 75b05fb3447c449ed14648edbf8382d046acafea Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Thu, 11 Jan 2024 17:17:36 +0100 Subject: [PATCH] time: docs improvements, add ci. --- .github/ci/doc.sh | 1 + .github/ci/test.sh | 1 + embassy-time-driver/README.md | 3 +-- embassy-time-driver/src/lib.rs | 16 +++++----------- embassy-time/README.md | 2 +- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/ci/doc.sh b/.github/ci/doc.sh index fbed2752a..0bbe7f690 100755 --- a/.github/ci/doc.sh +++ b/.github/ci/doc.sh @@ -30,6 +30,7 @@ docserver-builder -i ./embassy-nrf -o webroot/crates/embassy-nrf/git.zup docserver-builder -i ./embassy-rp -o webroot/crates/embassy-rp/git.zup docserver-builder -i ./embassy-sync -o webroot/crates/embassy-sync/git.zup docserver-builder -i ./embassy-time -o webroot/crates/embassy-time/git.zup +docserver-builder -i ./embassy-time-driver -o webroot/crates/embassy-time-driver/git.zup docserver-builder -i ./embassy-usb -o webroot/crates/embassy-usb/git.zup docserver-builder -i ./embassy-usb-driver -o webroot/crates/embassy-usb-driver/git.zup docserver-builder -i ./embassy-usb-logger -o webroot/crates/embassy-usb-logger/git.zup diff --git a/.github/ci/test.sh b/.github/ci/test.sh index b16b3c20d..b6a5bcd56 100755 --- a/.github/ci/test.sh +++ b/.github/ci/test.sh @@ -12,6 +12,7 @@ cargo test --manifest-path ./embassy-sync/Cargo.toml cargo test --manifest-path ./embassy-embedded-hal/Cargo.toml cargo test --manifest-path ./embassy-hal-internal/Cargo.toml cargo test --manifest-path ./embassy-time/Cargo.toml --features generic-queue,mock-driver +cargo test --manifest-path ./embassy-time-driver/Cargo.toml cargo test --manifest-path ./embassy-boot/boot/Cargo.toml cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features ed25519-dalek diff --git a/embassy-time-driver/README.md b/embassy-time-driver/README.md index 74a5b7876..426252d2c 100644 --- a/embassy-time-driver/README.md +++ b/embassy-time-driver/README.md @@ -1,6 +1,5 @@ # embassy-time-driver - This crate contains the driver trait necessary for adding [`embassy-time`](https://crates.io/crates/embassy-time) support for a new hardware platform. @@ -12,7 +11,7 @@ if the driver trait has not had breaking changes. ## How it works -`embassy-time` module is backed by a global "time driver" specified at build time. +`embassy-time` is backed by a global "time driver" specified at build time. Only one driver can be active in a program. All methods and structs transparently call into the active driver. This makes it diff --git a/embassy-time-driver/src/lib.rs b/embassy-time-driver/src/lib.rs index 39a772aa5..565597935 100644 --- a/embassy-time-driver/src/lib.rs +++ b/embassy-time-driver/src/lib.rs @@ -2,22 +2,17 @@ #![doc = include_str!("../README.md")] #![warn(missing_docs)] -//! Time driver interface -//! -//! This module defines the interface a driver needs to implement to power the `embassy_time` module. -//! -//! # Implementing a driver +//! ## Implementing a driver //! //! - Define a struct `MyDriver` //! - Implement [`Driver`] for it //! - Register it as the global driver with [`time_driver_impl`](crate::time_driver_impl). -//! - Enable the Cargo feature `embassy-executor/time` //! //! If your driver has a single set tick rate, enable the corresponding [`tick-hz-*`](crate#tick-rate) feature, //! which will prevent users from needing to configure it themselves (or selecting an incorrect configuration). //! //! If your driver supports a small number of set tick rates, expose your own cargo features and have each one -//! enable the corresponding `embassy-time/tick-*`. +//! enable the corresponding `embassy-time-driver/tick-*`. //! //! Otherwise, don’t enable any `tick-hz-*` feature to let the user configure the tick rate themselves by //! enabling a feature on `embassy-time`. @@ -43,7 +38,7 @@ //! # Example //! //! ``` -//! use embassy_time::driver::{Driver, AlarmHandle}; +//! use embassy_time_driver::{Driver, AlarmHandle}; //! //! struct MyDriver{} // not public! //! @@ -61,9 +56,8 @@ //! todo!() //! } //! } -//! ``` -//! ```ignore -//! embassy_time::time_driver_impl!(static DRIVER: MyDriver = MyDriver{}); +//! +//! embassy_time_driver::time_driver_impl!(static DRIVER: MyDriver = MyDriver{}); //! ``` //! ## Feature flags diff --git a/embassy-time/README.md b/embassy-time/README.md index 20772f1d8..f5d46df7b 100644 --- a/embassy-time/README.md +++ b/embassy-time/README.md @@ -21,7 +21,7 @@ All methods and structs transparently call into the active driver. This makes it possible for libraries to use `embassy_time` in a driver-agnostic way without requiring generic parameters. -For more details, check the [`embassy_time_driver`] crate. +For more details, check the [`embassy_time_driver`](https://crates.io/crates/embassy-time-driver) crate. ## Instants and Durations