From fd2fe62b5f6f5c9b8dceef33ffe3fd8c58eb2bec Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 8 Dec 2021 01:51:39 +0100 Subject: [PATCH] stm32/dma: rename is_stopped to is_running. Note that this does NOT invert the result of `en()` because it was wrong before. --- embassy-stm32/src/dma/bdma.rs | 6 +++--- embassy-stm32/src/dma/dma.rs | 6 +++--- embassy-stm32/src/dma/mod.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index 1dcd0c228..a33543f76 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs @@ -155,8 +155,8 @@ pac::dma_channels! { unsafe {low_level_api::request_stop(crate::pac::$dma_peri, $channel_num);} } - fn is_stopped(&self) -> bool { - unsafe {low_level_api::is_stopped(crate::pac::$dma_peri, $channel_num)} + fn is_running(&self) -> bool { + unsafe {low_level_api::is_running(crate::pac::$dma_peri, $channel_num)} } fn remaining_transfers(&mut self) -> u16 { unsafe {low_level_api::get_remaining_transfers(crate::pac::$dma_peri, $channel_num)} @@ -240,7 +240,7 @@ mod low_level_api { fence(Ordering::SeqCst); } - pub unsafe fn is_stopped(dma: pac::bdma::Dma, ch: u8) -> bool { + pub unsafe fn is_running(dma: pac::bdma::Dma, ch: u8) -> bool { let ch = dma.ch(ch as _); ch.cr().read().en() } diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index c99ff27ba..a5a959df4 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs @@ -149,8 +149,8 @@ pac::dma_channels! { unsafe {low_level_api::request_stop(&crate::pac::$dma_peri, $channel_num);} } - fn is_stopped(&self) -> bool { - unsafe {low_level_api::is_stopped(&crate::pac::$dma_peri, $channel_num)} + fn is_running(&self) -> bool { + unsafe {low_level_api::is_running(&crate::pac::$dma_peri, $channel_num)} } fn remaining_transfers(&mut self) -> u16 { @@ -240,7 +240,7 @@ mod low_level_api { } /// Gets the running status of the channel - pub unsafe fn is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool { + pub unsafe fn is_running(dma: &pac::dma::Dma, ch: u8) -> bool { // get a handle on the channel itself let ch = dma.st(ch as _); diff --git a/embassy-stm32/src/dma/mod.rs b/embassy-stm32/src/dma/mod.rs index 3928bbb92..f27a55f61 100644 --- a/embassy-stm32/src/dma/mod.rs +++ b/embassy-stm32/src/dma/mod.rs @@ -49,7 +49,7 @@ pub(crate) mod sealed { fn request_stop(&mut self); /// Returns whether this channel is active or stopped. - fn is_stopped(&self) -> bool; + fn is_running(&self) -> bool; /// Returns the total number of remaining transfers. fn remaining_transfers(&mut self) -> u16; @@ -173,10 +173,10 @@ mod transfers { // TODO in the future, error checking could be added so that this function returns an error - if channel.is_stopped() { - Poll::Ready(()) - } else { + if channel.is_running() { Poll::Pending + } else { + Poll::Ready(()) } }) .await