We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 98a6fb8 commit 9a84bdbCopy full SHA for 9a84bdb
src/timer.rs
@@ -57,6 +57,23 @@ use void::Void;
57
/// # fn wait(&mut self) -> ::nb::Result<(), Void> { Ok(()) }
58
/// # }
59
/// ```
60
+///
61
+/// If you want to use a CountDown timer as an opaque type in a HAL-based driver, you have to add
62
+/// some type bounds to make sure arguments passed to `start` can be used by the underlying
63
+/// (concrete) `CountDown::Time` type:
64
+/// ```rust
65
+/// extern crate embedded_hal as hal;
66
+/// #[macro_use(block)]
67
68
+/// pub fn uses_timer<T, U>(t: T)
69
+/// where
70
+/// T: hal::timer::CountDown<Time=U>,
71
+/// U: From<u32>,
72
+/// {
73
+/// // delay an arbitrary 1 time unit
74
+/// t.start(1);
75
+/// }
76
+/// ```
77
pub trait CountDown {
78
/// The unit of time used by this timer
79
type Time;
0 commit comments