Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait at end of ehal 0.2 blocking SPI writes #743

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased Changes

- Fix blocking behaviour for `embedded-hal` 0.2 SPI writes
- Fix I2C transaction to be as continuous as possible according to `embedded-hal` specification
- Allow configuring USB clock with `GenericClockController` on atsamd11
- fix samd51j not having i2s support
Expand Down
4 changes: 4 additions & 0 deletions hal/src/sercom/spi/impl_ehal_thumbv6m.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ macro_rules! impl_blocking_spi_write {
}
}
}
// Wait until all data is shifted out
while !self.read_flags().contains(Flags::TXC) {}
Ok(())
}
}
Expand Down Expand Up @@ -666,6 +668,8 @@ macro_rules! impl_blocking_spi_write_iter {
}
}
}
// Wait until all data is shifted out
while !self.read_flags().contains(Flags::TXC) {}
Ok(())
}
}
Expand Down
14 changes: 12 additions & 2 deletions hal/src/sercom/spi/impl_ehal_thumbv7em.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,8 @@ macro_rules! impl_blocking_spi_write {
}
}
}
// Wait until all data is shifted out
while !self.read_flags().contains(Flags::TXC) {}
Ok(())
}
}
Expand Down Expand Up @@ -632,7 +634,10 @@ where
panic!("Slice length does not equal SPI transfer length");
}
let sercom = unsafe { self.config.as_ref().sercom() };
write_slice(sercom, buf, false)
write_slice(sercom, buf, false)?;
// Wait until all data is shifted out
while !self.read_flags().contains(Flags::TXC) {}
Ok(())
}
}

Expand Down Expand Up @@ -687,7 +692,10 @@ where
panic!("Slice length does not equal SPI transfer length");
}
let sercom = unsafe { self.config.as_ref().sercom() };
write_slice(sercom, buf, false)
write_slice(sercom, buf, false)?;
// Wait until all data is shifted out
while !self.read_flags().contains(Flags::TXC) {}
Ok(())
}
}

Expand Down Expand Up @@ -779,6 +787,8 @@ macro_rules! impl_blocking_spi_write_iter {
}
}
}
// Wait until all data is shifted out
while !self.read_flags().contains(Flags::TXC) {}
Ok(())
}
}
Expand Down
Loading