Skip to content

Commit 513807e

Browse files
committed
Remove traits with unconstrained Time associated types.
As discussed in #201 and #177 (comment) , the traits that have an unconstrained `type Time` associated type end up not being usable for HAL-independent drivers in practice, since there is too much variation across HALs of what the actual Time type is. These should be bound to something, probably a `Duration` trait, so that drivers can actually create and use them. Alternatively embedded-hal could have actual `struct Duration` and so. Either way, it's unclear what the final solution would look like. We shouldn't leave these traits in the 1.0 release, since fixing them later will be a breaking change. We should temporarily remove them, and add them back once we have figured this out which won't be a breaking change.
1 parent 4f3ada1 commit 513807e

File tree

6 files changed

+1
-605
lines changed

6 files changed

+1
-605
lines changed

src/capture.rs

-130
This file was deleted.

src/lib.rs

-58
Original file line numberDiff line numberDiff line change
@@ -258,60 +258,6 @@
258258
//! # fn main() {}
259259
//! ```
260260
//!
261-
//! - Blocking serial read with timeout
262-
//!
263-
//! ```
264-
//! use embedded_hal as hal;
265-
//! use hal::nb;
266-
//!
267-
//! use hal::serial::nb::Write;
268-
//! use hal::timer::nb::CountDown;
269-
//!
270-
//! enum Error<SE, TE> {
271-
//! /// Serial interface error
272-
//! Serial(SE),
273-
//! /// Timeout error
274-
//! TimedOut(TE),
275-
//! }
276-
//!
277-
//! fn read_with_timeout<S, T>(
278-
//! serial: &mut S,
279-
//! timer: &mut T,
280-
//! timeout: T::Time,
281-
//! ) -> Result<u8, Error<S::Error, T::Error>>
282-
//! where
283-
//! T: hal::timer::nb::CountDown<Error = ()>,
284-
//! S: hal::serial::nb::Read<u8>,
285-
//! {
286-
//! timer.start(timeout).map_err(Error::TimedOut)?;
287-
//!
288-
//! loop {
289-
//! match serial.read() {
290-
//! // raise error
291-
//! Err(nb::Error::Other(e)) => return Err(Error::Serial(e)),
292-
//! Err(nb::Error::WouldBlock) => {
293-
//! // no data available yet, check the timer below
294-
//! },
295-
//! Ok(byte) => return Ok(byte),
296-
//! }
297-
//!
298-
//! match timer.wait() {
299-
//! Err(nb::Error::Other(e)) => {
300-
//! // The error type specified by `timer.wait()` is `!`, which
301-
//! // means no error can actually occur. The Rust compiler
302-
//! // still forces us to provide this match arm, though.
303-
//! unreachable!()
304-
//! },
305-
//! // no timeout yet, try again
306-
//! Err(nb::Error::WouldBlock) => continue,
307-
//! Ok(()) => return Err(Error::TimedOut(())),
308-
//! }
309-
//! }
310-
//! }
311-
//!
312-
//! # fn main() {}
313-
//! ```
314-
//!
315261
//! - Buffered serial interface with periodic flushing in interrupt handler
316262
//!
317263
//! ```
@@ -410,16 +356,12 @@ pub mod fmt;
410356
pub use nb;
411357
pub mod adc;
412358
pub mod can;
413-
pub mod capture;
414359
pub mod delay;
415360
pub mod digital;
416361
pub mod i2c;
417-
pub mod pwm;
418362
pub mod qei;
419363
pub mod serial;
420364
pub mod spi;
421-
pub mod timer;
422-
pub mod watchdog;
423365

424366
mod private {
425367
use crate::i2c::{SevenBitAddress, TenBitAddress};

0 commit comments

Comments
 (0)