Skip to content

Commit

Permalink
Merge pull request #642 from jannic/eh-1-0-0-alpha-11
Browse files Browse the repository at this point in the history
Update to embedded-hal 1.0.0-alpha.11
  • Loading branch information
jannic authored Jul 6, 2023
2 parents 17aa070 + b5930a2 commit 6c74c62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
4 changes: 2 additions & 2 deletions rp2040-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ targets = ["thumbv6m-none-eabi"]
[dependencies]
cortex-m = "0.7.2"
embedded-hal = { version = "0.2.5", features = ["unproven"] }
eh1_0_alpha = { package = "embedded-hal", version = "=1.0.0-alpha.10", optional = true }
eh_nb_1_0_alpha = { package = "embedded-hal-nb", version = "=1.0.0-alpha.2", optional = true }
eh1_0_alpha = { package = "embedded-hal", version = "=1.0.0-alpha.11", optional = true }
eh_nb_1_0_alpha = { package = "embedded-hal-nb", version = "=1.0.0-alpha.3", optional = true }
embedded-dma = "0.2.0"
fugit = "0.3.6"
itertools = { version = "0.10.1", default-features = false }
Expand Down
21 changes: 6 additions & 15 deletions rp2040-hal/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,7 @@ macro_rules! impl_write {
}

#[cfg(feature = "eh1_0_alpha")]
impl<D: SpiDevice, P: ValidSpiPinout<D>> eh1::SpiBusFlush for Spi<Enabled, D, P, $nr> {
fn flush(&mut self) -> Result<(), Self::Error> {
while self.is_busy() {}
Ok(())
}
}

#[cfg(feature = "eh1_0_alpha")]
impl<D: SpiDevice, P: ValidSpiPinout<D>> eh1::SpiBusRead<$type> for Spi<Enabled, D, P, $nr> {
impl<D: SpiDevice, P: ValidSpiPinout<D>> eh1::SpiBus<$type> for Spi<Enabled, D, P, $nr> {
fn read(&mut self, words: &mut [$type]) -> Result<(), Self::Error> {
for word in words.iter_mut() {
// write empty word
Expand All @@ -365,10 +357,7 @@ macro_rules! impl_write {
}
Ok(())
}
}

#[cfg(feature = "eh1_0_alpha")]
impl<D: SpiDevice, P: ValidSpiPinout<D>> eh1::SpiBusWrite<$type> for Spi<Enabled, D, P, $nr> {
fn write(&mut self, words: &[$type]) -> Result<(), Self::Error> {
for word in words.iter() {
// write one word
Expand All @@ -383,10 +372,7 @@ macro_rules! impl_write {
}
Ok(())
}
}

#[cfg(feature = "eh1_0_alpha")]
impl<D: SpiDevice, P: ValidSpiPinout<D>> eh1::SpiBus<$type> for Spi<Enabled, D, P, $nr> {
fn transfer(&mut self, read: &mut [$type], write: &[$type]) -> Result<(), Self::Error>{
let len = read.len().max(write.len());
for i in 0..len {
Expand Down Expand Up @@ -423,6 +409,11 @@ macro_rules! impl_write {

Ok(())
}

fn flush(&mut self) -> Result<(), Self::Error> {
while self.is_busy() {}
Ok(())
}
}

#[cfg(feature = "eh1_0_alpha")]
Expand Down

0 comments on commit 6c74c62

Please sign in to comment.