diff --git a/CHANGELOG.md b/CHANGELOG.md index f91a6b99..7373a294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/dma/mod.rs b/src/dma/mod.rs index 30b2d481..9ee506b8 100644 --- a/src/dma/mod.rs +++ b/src/dma/mod.rs @@ -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::<::MemSize>() / 2;