time: docs improvements, add ci.

This commit is contained in:
Dario Nieuwenhuis 2024-01-11 17:17:36 +01:00
parent 650f566149
commit 75b05fb344
5 changed files with 9 additions and 14 deletions

1
.github/ci/doc.sh vendored
View File

@ -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-rp -o webroot/crates/embassy-rp/git.zup
docserver-builder -i ./embassy-sync -o webroot/crates/embassy-sync/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 -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 -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-driver -o webroot/crates/embassy-usb-driver/git.zup
docserver-builder -i ./embassy-usb-logger -o webroot/crates/embassy-usb-logger/git.zup docserver-builder -i ./embassy-usb-logger -o webroot/crates/embassy-usb-logger/git.zup

1
.github/ci/test.sh vendored
View File

@ -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-embedded-hal/Cargo.toml
cargo test --manifest-path ./embassy-hal-internal/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/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
cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features ed25519-dalek cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features ed25519-dalek

View File

@ -1,6 +1,5 @@
# embassy-time-driver # embassy-time-driver
This crate contains the driver trait necessary for adding [`embassy-time`](https://crates.io/crates/embassy-time) support This crate contains the driver trait necessary for adding [`embassy-time`](https://crates.io/crates/embassy-time) support
for a new hardware platform. for a new hardware platform.
@ -12,7 +11,7 @@ if the driver trait has not had breaking changes.
## How it works ## 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. Only one driver can be active in a program.
All methods and structs transparently call into the active driver. This makes it All methods and structs transparently call into the active driver. This makes it

View File

@ -2,22 +2,17 @@
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
#![warn(missing_docs)] #![warn(missing_docs)]
//! Time driver interface //! ## Implementing a driver
//!
//! This module defines the interface a driver needs to implement to power the `embassy_time` module.
//!
//! # Implementing a driver
//! //!
//! - Define a struct `MyDriver` //! - Define a struct `MyDriver`
//! - Implement [`Driver`] for it //! - Implement [`Driver`] for it
//! - Register it as the global driver with [`time_driver_impl`](crate::time_driver_impl). //! - 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, //! 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). //! 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 //! 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, dont enable any `tick-hz-*` feature to let the user configure the tick rate themselves by //! Otherwise, dont enable any `tick-hz-*` feature to let the user configure the tick rate themselves by
//! enabling a feature on `embassy-time`. //! enabling a feature on `embassy-time`.
@ -43,7 +38,7 @@
//! # Example //! # Example
//! //!
//! ``` //! ```
//! use embassy_time::driver::{Driver, AlarmHandle}; //! use embassy_time_driver::{Driver, AlarmHandle};
//! //!
//! struct MyDriver{} // not public! //! struct MyDriver{} // not public!
//! //!
@ -61,9 +56,8 @@
//! todo!() //! todo!()
//! } //! }
//! } //! }
//! ``` //!
//! ```ignore //! embassy_time_driver::time_driver_impl!(static DRIVER: MyDriver = MyDriver{});
//! embassy_time::time_driver_impl!(static DRIVER: MyDriver = MyDriver{});
//! ``` //! ```
//! ## Feature flags //! ## Feature flags

View File

@ -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 possible for libraries to use `embassy_time` in a driver-agnostic way without
requiring generic parameters. 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 ## Instants and Durations