mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 00:02:28 +00:00
Merge pull request #2434 from embassy-rs/time-driver-crate
time: docs improvements, add ci.
This commit is contained in:
commit
ae84f2a157
1
.github/ci/doc.sh
vendored
1
.github/ci/doc.sh
vendored
@ -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
|
||||
|
1
.github/ci/test.sh
vendored
1
.github/ci/test.sh
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user