Skip to content

Commit

Permalink
DMA: add a method to wait for transfer completion
Browse files Browse the repository at this point in the history
  • Loading branch information
imihajlow committed Oct 20, 2022
1 parent 6d0c292 commit 1f9dd9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- example of using USB CDC with interrupts.
- Added non-blocking I2C based on DMA [#534]
- Added Transactional I2C API [#542]
- Added wait method for DMA Transfer.

[#481]: https://github.com/stm32-rs/stm32f4xx-hal/pull/481
[#489]: https://github.com/stm32-rs/stm32f4xx-hal/pull/489
Expand Down
6 changes: 6 additions & 0 deletions src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,12 @@ where
&mut self.stream
}

/// Wait for the transfer to complete.
#[inline(always)]
pub fn wait(&self) {
while !STREAM::get_transfer_complete_flag() {}
}

/// Applies all fields in DmaConfig.
fn apply_config(stream: &mut STREAM, config: config::DmaConfig) {
let msize = mem::size_of::<<PERIPHERAL as PeriAddress>::MemSize>() / 2;
Expand Down

0 comments on commit 1f9dd9f

Please sign in to comment.