File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 2
2
. # *
3
3
/target /
4
4
Cargo.lock
5
+ . * .sw *
Original file line number Diff line number Diff line change @@ -57,6 +57,23 @@ use void::Void;
57
57
/// # fn wait(&mut self) -> ::nb::Result<(), Void> { Ok(()) }
58
58
/// # }
59
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
+ /// ```
60
77
pub trait CountDown {
61
78
/// The unit of time used by this timer
62
79
type Time ;
You can’t perform that action at this time.
0 commit comments