aboutsummaryrefslogtreecommitdiff
path: root/embassy-time-driver
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-01-11 17:17:36 +0100
committerDario Nieuwenhuis <[email protected]>2024-01-11 17:17:58 +0100
commit75b05fb3447c449ed14648edbf8382d046acafea (patch)
treef025105ae7449df92f5f42abda0d3bdf094e774d /embassy-time-driver
parent650f5661495e5c0d6fe25bd3742058a02ac0bae1 (diff)
time: docs improvements, add ci.
Diffstat (limited to 'embassy-time-driver')
-rw-r--r--embassy-time-driver/README.md3
-rw-r--r--embassy-time-driver/src/lib.rs16
2 files changed, 6 insertions, 13 deletions
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 @@
1# embassy-time-driver 1# embassy-time-driver
2 2
3
4This crate contains the driver trait necessary for adding [`embassy-time`](https://crates.io/crates/embassy-time) support 3This crate contains the driver trait necessary for adding [`embassy-time`](https://crates.io/crates/embassy-time) support
5for a new hardware platform. 4for a new hardware platform.
6 5
@@ -12,7 +11,7 @@ if the driver trait has not had breaking changes.
12 11
13## How it works 12## How it works
14 13
15`embassy-time` module is backed by a global "time driver" specified at build time. 14`embassy-time` is backed by a global "time driver" specified at build time.
16Only one driver can be active in a program. 15Only one driver can be active in a program.
17 16
18All methods and structs transparently call into the active driver. This makes it 17All 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 @@
2#![doc = include_str!("../README.md")] 2#![doc = include_str!("../README.md")]
3#![warn(missing_docs)] 3#![warn(missing_docs)]
4 4
5//! Time driver interface 5//! ## Implementing a driver
6//!
7//! This module defines the interface a driver needs to implement to power the `embassy_time` module.
8//!
9//! # Implementing a driver
10//! 6//!
11//! - Define a struct `MyDriver` 7//! - Define a struct `MyDriver`
12//! - Implement [`Driver`] for it 8//! - Implement [`Driver`] for it
13//! - Register it as the global driver with [`time_driver_impl`](crate::time_driver_impl). 9//! - Register it as the global driver with [`time_driver_impl`](crate::time_driver_impl).
14//! - Enable the Cargo feature `embassy-executor/time`
15//! 10//!
16//! If your driver has a single set tick rate, enable the corresponding [`tick-hz-*`](crate#tick-rate) feature, 11//! If your driver has a single set tick rate, enable the corresponding [`tick-hz-*`](crate#tick-rate) feature,
17//! which will prevent users from needing to configure it themselves (or selecting an incorrect configuration). 12//! which will prevent users from needing to configure it themselves (or selecting an incorrect configuration).
18//! 13//!
19//! If your driver supports a small number of set tick rates, expose your own cargo features and have each one 14//! If your driver supports a small number of set tick rates, expose your own cargo features and have each one
20//! enable the corresponding `embassy-time/tick-*`. 15//! enable the corresponding `embassy-time-driver/tick-*`.
21//! 16//!
22//! Otherwise, don’t enable any `tick-hz-*` feature to let the user configure the tick rate themselves by 17//! Otherwise, don’t enable any `tick-hz-*` feature to let the user configure the tick rate themselves by
23//! enabling a feature on `embassy-time`. 18//! enabling a feature on `embassy-time`.
@@ -43,7 +38,7 @@
43//! # Example 38//! # Example
44//! 39//!
45//! ``` 40//! ```
46//! use embassy_time::driver::{Driver, AlarmHandle}; 41//! use embassy_time_driver::{Driver, AlarmHandle};
47//! 42//!
48//! struct MyDriver{} // not public! 43//! struct MyDriver{} // not public!
49//! 44//!
@@ -61,9 +56,8 @@
61//! todo!() 56//! todo!()
62//! } 57//! }
63//! } 58//! }
64//! ``` 59//!
65//! ```ignore 60//! embassy_time_driver::time_driver_impl!(static DRIVER: MyDriver = MyDriver{});
66//! embassy_time::time_driver_impl!(static DRIVER: MyDriver = MyDriver{});
67//! ``` 61//! ```
68 62
69//! ## Feature flags 63//! ## Feature flags