Skip to content

Commit 2f5d994

Browse files
bors[bot]Dirbaio
andauthored
Merge #324
324: Remove traits with unconstrained `Time` associated types. r=eldruin a=Dirbaio 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. Co-authored-by: Dario Nieuwenhuis <[email protected]>
2 parents c90fc2a + 513807e commit 2f5d994

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
//! ```
@@ -411,16 +357,12 @@ pub mod fmt;
411357
pub use nb;
412358
pub mod adc;
413359
pub mod can;
414-
pub mod capture;
415360
pub mod delay;
416361
pub mod digital;
417362
pub mod i2c;
418-
pub mod pwm;
419363
pub mod qei;
420364
pub mod serial;
421365
pub mod spi;
422-
pub mod timer;
423-
pub mod watchdog;
424366

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

0 commit comments

Comments
 (0)