Skip to content

Commit 7ebd9c5

Browse files
authored
Merge branch 'master' into master
2 parents 92e0da4 + facfe77 commit 7ebd9c5

File tree

8 files changed

+17
-54
lines changed

8 files changed

+17
-54
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1818
- Moved all traits into two modules depending on the execution model: `blocking` and `nb` (non-blocking).
1919
- Re-export `nb::{block!, Error, Result}` to avoid version mismatches. These should be used instead of
2020
importing the `nb` crate directly in dependendent crates.
21+
- `blocking::Serial`: renamed `bwrite_all` to `write`, `bflush` to `flush.
22+
- Removed `prelude` to avoid method name conflicts between different flavors (blocking, nb) of the same trait. Traits must now be manually imported.
2123

2224
## [v1.0.0-alpha.4] - 2020-11-11
2325

src/blocking/pwm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/// ```
1010
/// extern crate embedded_hal as hal;
1111
///
12-
/// use hal::prelude::*;
12+
/// use hal::blocking::pwm::Pwm;
1313
///
1414
/// fn main() {
1515
/// let mut pwm: Pwm1 = {

src/blocking/qei.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
/// #[macro_use(block)]
1212
/// extern crate nb;
1313
///
14-
/// use hal::prelude::*;
14+
/// use hal::blocking::qei::Qei;
15+
/// use hal::nb::timer::CountDown;
1516
///
1617
/// fn main() {
1718
/// let mut qei: Qei1 = {

src/blocking/serial.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ pub trait Write<Word> {
1010
/// An implementation can choose to buffer the write, returning `Ok(())`
1111
/// after the complete slice has been written to a buffer, but before all
1212
/// words have been sent via the serial interface. To make sure that
13-
/// everything has been sent, call [`bflush`] after this function returns.
13+
/// everything has been sent, call [`flush`] after this function returns.
1414
///
15-
/// [`bflush`]: #tymethod.bflush
16-
fn bwrite_all(&mut self, buffer: &[Word]) -> Result<(), Self::Error>;
15+
/// [`flush`]: #tymethod.flush
16+
fn write(&mut self, buffer: &[Word]) -> Result<(), Self::Error>;
1717

1818
/// Block until the serial interface has sent all buffered words
19-
fn bflush(&mut self) -> Result<(), Self::Error>;
19+
fn flush(&mut self) -> Result<(), Self::Error>;
2020
}
2121

2222
/// Blocking serial write
@@ -38,15 +38,15 @@ pub mod write {
3838
{
3939
type Error = S::Error;
4040

41-
fn bwrite_all(&mut self, buffer: &[Word]) -> Result<(), Self::Error> {
41+
fn write(&mut self, buffer: &[Word]) -> Result<(), Self::Error> {
4242
for word in buffer {
4343
nb::block!(self.write(word.clone()))?;
4444
}
4545

4646
Ok(())
4747
}
4848

49-
fn bflush(&mut self) -> Result<(), Self::Error> {
49+
fn flush(&mut self) -> Result<(), Self::Error> {
5050
nb::block!(self.flush())?;
5151
Ok(())
5252
}

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
//! ```
245245
//! use embedded_hal as hal;
246246
//! use nb::block;
247-
//! use hal::prelude::*;
247+
//! use hal::nb::serial::Write;
248248
//!
249249
//! fn write_all<S>(serial: &mut S, buffer: &[u8]) -> Result<(), S::Error>
250250
//! where
@@ -266,7 +266,8 @@
266266
//! use embedded_hal as hal;
267267
//! use nb;
268268
//!
269-
//! use hal::prelude::*;
269+
//! use hal::nb::serial::Write;
270+
//! use hal::nb::timer::CountDown;
270271
//!
271272
//! enum Error<SE, TE> {
272273
//! /// Serial interface error
@@ -320,7 +321,7 @@
320321
//! use embedded_hal as hal;
321322
//! use nb;
322323
//!
323-
//! use hal::prelude::*;
324+
//! use hal::nb::serial::Write;
324325
//! use ::core::convert::Infallible;
325326
//!
326327
//! fn flush<S>(serial: &mut S, cb: &mut CircularBuffer)
@@ -414,7 +415,6 @@ pub mod fmt;
414415
pub mod nb;
415416
#[cfg(feature = "unstable-futures")]
416417
pub mod futures;
417-
pub mod prelude;
418418

419419
mod private {
420420
use crate::blocking::i2c::{SevenBitAddress, TenBitAddress};

src/nb/capture.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// #[macro_use(block)]
1313
/// extern crate nb;
1414
///
15-
/// use hal::prelude::*;
15+
/// use hal::nb::capture::Capture;
1616
///
1717
/// fn main() {
1818
/// let mut capture: Capture1 = {

src/nb/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/// #[macro_use(block)]
2020
/// extern crate nb;
2121
///
22-
/// use hal::prelude::*;
22+
/// use hal::nb::timer::CountDown;
2323
///
2424
/// fn main() {
2525
/// let mut led: Led = {

src/prelude.rs

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)