diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-01-11 17:17:36 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-01-11 17:17:58 +0100 |
| commit | 75b05fb3447c449ed14648edbf8382d046acafea (patch) | |
| tree | f025105ae7449df92f5f42abda0d3bdf094e774d /embassy-time-driver/src/lib.rs | |
| parent | 650f5661495e5c0d6fe25bd3742058a02ac0bae1 (diff) | |
time: docs improvements, add ci.
Diffstat (limited to 'embassy-time-driver/src/lib.rs')
| -rw-r--r-- | embassy-time-driver/src/lib.rs | 16 |
1 files changed, 5 insertions, 11 deletions
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 |
