Skip to content

Commit 1f9dd9f

Browse files
committed
DMA: add a method to wait for transfer completion
1 parent 6d0c292 commit 1f9dd9f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4343
- example of using USB CDC with interrupts.
4444
- Added non-blocking I2C based on DMA [#534]
4545
- Added Transactional I2C API [#542]
46+
- Added wait method for DMA Transfer.
4647

4748
[#481]: https://github.com/stm32-rs/stm32f4xx-hal/pull/481
4849
[#489]: https://github.com/stm32-rs/stm32f4xx-hal/pull/489

src/dma/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,12 @@ where
13551355
&mut self.stream
13561356
}
13571357

1358+
/// Wait for the transfer to complete.
1359+
#[inline(always)]
1360+
pub fn wait(&self) {
1361+
while !STREAM::get_transfer_complete_flag() {}
1362+
}
1363+
13581364
/// Applies all fields in DmaConfig.
13591365
fn apply_config(stream: &mut STREAM, config: config::DmaConfig) {
13601366
let msize = mem::size_of::<<PERIPHERAL as PeriAddress>::MemSize>() / 2;

0 commit comments

Comments
 (0)