Skip to content

Commit

Permalink
Merge #545
Browse files Browse the repository at this point in the history
545: DMA: add a method to wait for transfer completion r=burrbull a=imihajlow



Co-authored-by: Ivan Mikhailov <[email protected]>
  • Loading branch information
bors[bot] and imihajlow authored May 6, 2023
2 parents bf445ea + 1f9dd9f commit 14c7cb4
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 @@ -154,6 +154,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 @@ -1365,6 +1365,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 14c7cb4

Please sign in to comment.