diff --git a/src/timer.rs b/src/timer.rs index 74cf088f3..84d5720a1 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -57,6 +57,22 @@ use void::Void; /// # fn wait(&mut self) -> ::nb::Result<(), Void> { Ok(()) } /// # } /// ``` +/// +/// If you want to use a CountDown timer as an opaque type in a HAL-based driver, you have to add +/// some type bounds to make sure arguments passed to `start` can be used by the underlying +/// (concrete) `CountDown::Time` type: +/// ```rust +/// extern crate embedded_hal as hal; +/// +/// pub fn uses_timer(t: &mut T) +/// where +/// T: hal::timer::CountDown, +/// U: From, +/// { +/// // delay an arbitrary 1 time unit +/// t.start(1); +/// } +/// ``` pub trait CountDown { /// The unit of time used by this timer type Time;