Skip to content

Commit

Permalink
Try #109:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] committed Feb 25, 2019
2 parents dd92c3a + 6e2e5c1 commit 4c3ad35
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, U>(t: &mut T)
/// where
/// T: hal::timer::CountDown<Time=U>,
/// U: From<u32>,
/// {
/// // delay an arbitrary 1 time unit
/// t.start(1);
/// }
/// ```
pub trait CountDown {
/// The unit of time used by this timer
type Time;
Expand Down

0 comments on commit 4c3ad35

Please sign in to comment.