Skip to content

Commit ba2e937

Browse files
committed
update to embedded-hal=1.0.0.alpha-11
see [their changelog][eh-changelog] for further details. [eh-changelog]: https://github.com/rust-embedded/embedded-hal/blob/v1.0.0-alpha.11/embedded-hal/CHANGELOG.md
1 parent 938576f commit ba2e937

File tree

3 files changed

+13
-27
lines changed

3 files changed

+13
-27
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
- `rcc::Enable`, `rcc::LPEnable` traits, timclk in `Clocks` instead of prescalers [#665]
1313
- move gpio, dma impls, adc pins in subdir, remove unused `From` impls [#658] [#664]
14-
- Bump `embedded-hal` to `1.0.0-alpha.10`. See [their changelog][embedded-hal-1.0.0-alpha.10] for further details. Note that this included breaking changes to the previous alpha APIs. [#663]
14+
- Bump `embedded-hal` to `1.0.0-alpha.11`. See [their changelog][embedded-hal-1.0.0-alpha.11] for further details. Note that this included breaking changes to the previous alpha APIs. [#663],[#668]
1515
- Fix race condition in sending start condition in I2C. [#662]
1616

1717
[#658]: https://github.com/stm32-rs/stm32f4xx-hal/pull/658
1818
[#662]: https://github.com/stm32-rs/stm32f4xx-hal/pull/662
1919
[#663]: https://github.com/stm32-rs/stm32f4xx-hal/pull/663
2020
[#664]: https://github.com/stm32-rs/stm32f4xx-hal/pull/664
2121
[#665]: https://github.com/stm32-rs/stm32f4xx-hal/pull/665
22-
[embedded-hal-1.0.0-alpha.10]: https://github.com/rust-embedded/embedded-hal/blob/v1.0.0-alpha.10/embedded-hal/CHANGELOG.md
22+
[#668]: https://github.com/stm32-rs/stm32f4xx-hal/pull/668
23+
[embedded-hal-1.0.0-alpha.11]: https://github.com/rust-embedded/embedded-hal/blob/v1.0.0-alpha.11/embedded-hal/CHANGELOG.md
2324

2425
## [v0.16.2] - 2023-06-27
2526

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ embedded-dma = "0.2.0"
4040
bare-metal = { version = "1" }
4141
void = { default-features = false, version = "1.0.2" }
4242
embedded-hal = { features = ["unproven"], version = "0.2.7" }
43-
embedded-hal-nb = "1.0.0-alpha.2"
43+
embedded-hal-nb = "1.0.0-alpha.3"
4444
display-interface = { version = "0.4.1", optional = true }
4545
fugit = "0.3.6"
4646
fugit-timer = "0.1.3"
@@ -54,7 +54,7 @@ version = "0.3.14"
5454
default-features = false
5555

5656
[dependencies.embedded-hal-one]
57-
version = "=1.0.0-alpha.10"
57+
version = "=1.0.0-alpha.11"
5858
package = "embedded-hal"
5959

6060
[dependencies.stm32_i2s_v12x]

src/spi/hal_1.rs

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ mod nb {
6363

6464
mod blocking {
6565
use super::super::{FrameSize, Instance, Spi};
66-
use embedded_hal_one::spi::{SpiBus, SpiBusFlush, SpiBusRead, SpiBusWrite};
66+
use embedded_hal_one::spi::SpiBus;
6767

6868
impl<SPI, const BIDI: bool, W: FrameSize + 'static> SpiBus<W> for Spi<SPI, BIDI, W>
6969
where
@@ -76,21 +76,16 @@ mod blocking {
7676
fn transfer(&mut self, buff: &mut [W], data: &[W]) -> Result<(), Self::Error> {
7777
self.transfer(buff, data)
7878
}
79-
}
8079

81-
impl<SPI, const BIDI: bool, W> SpiBusFlush for Spi<SPI, BIDI, W>
82-
where
83-
SPI: Instance,
84-
{
85-
fn flush(&mut self) -> Result<(), Self::Error> {
80+
fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
81+
for word in words {
82+
nb::block!(self.write_nonblocking(W::default()))?;
83+
*word = nb::block!(self.read_nonblocking())?;
84+
}
85+
8686
Ok(())
8787
}
88-
}
8988

90-
impl<SPI, const BIDI: bool, W: FrameSize + 'static> SpiBusWrite<W> for Spi<SPI, BIDI, W>
91-
where
92-
SPI: Instance,
93-
{
9489
fn write(&mut self, words: &[W]) -> Result<(), Self::Error> {
9590
for word in words {
9691
nb::block!(self.write_nonblocking(*word))?;
@@ -101,18 +96,8 @@ mod blocking {
10196

10297
Ok(())
10398
}
104-
}
105-
106-
impl<SPI, const BIDI: bool, W: FrameSize + 'static> SpiBusRead<W> for Spi<SPI, BIDI, W>
107-
where
108-
SPI: Instance,
109-
{
110-
fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
111-
for word in words {
112-
nb::block!(self.write_nonblocking(W::default()))?;
113-
*word = nb::block!(self.read_nonblocking())?;
114-
}
11599

100+
fn flush(&mut self) -> Result<(), Self::Error> {
116101
Ok(())
117102
}
118103
}

0 commit comments

Comments
 (0)