File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 22. #*
33/target /
44Cargo.lock
5+ . * .sw *
Original file line number Diff line number Diff line change @@ -57,6 +57,23 @@ use void::Void;
5757/// # fn wait(&mut self) -> ::nb::Result<(), Void> { Ok(()) }
5858/// # }
5959/// ```
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+ /// ```
6077pub trait CountDown {
6178 /// The unit of time used by this timer
6279 type Time ;
You can’t perform that action at this time.
0 commit comments