aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-12-08 01:51:39 +0100
committerDario Nieuwenhuis <[email protected]>2021-12-08 01:51:39 +0100
commitfd2fe62b5f6f5c9b8dceef33ffe3fd8c58eb2bec (patch)
treecc8191bf0dfe493457fd2125b97c2b1cd46d761f
parentb2910558d36929dfde056f609a8af23d925e67f6 (diff)
stm32/dma: rename is_stopped to is_running.
Note that this does NOT invert the result of `en()` because it was wrong before.
-rw-r--r--embassy-stm32/src/dma/bdma.rs6
-rw-r--r--embassy-stm32/src/dma/dma.rs6
-rw-r--r--embassy-stm32/src/dma/mod.rs8
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! {
155 unsafe {low_level_api::request_stop(crate::pac::$dma_peri, $channel_num);} 155 unsafe {low_level_api::request_stop(crate::pac::$dma_peri, $channel_num);}
156 } 156 }
157 157
158 fn is_stopped(&self) -> bool { 158 fn is_running(&self) -> bool {
159 unsafe {low_level_api::is_stopped(crate::pac::$dma_peri, $channel_num)} 159 unsafe {low_level_api::is_running(crate::pac::$dma_peri, $channel_num)}
160 } 160 }
161 fn remaining_transfers(&mut self) -> u16 { 161 fn remaining_transfers(&mut self) -> u16 {
162 unsafe {low_level_api::get_remaining_transfers(crate::pac::$dma_peri, $channel_num)} 162 unsafe {low_level_api::get_remaining_transfers(crate::pac::$dma_peri, $channel_num)}
@@ -240,7 +240,7 @@ mod low_level_api {
240 fence(Ordering::SeqCst); 240 fence(Ordering::SeqCst);
241 } 241 }
242 242
243 pub unsafe fn is_stopped(dma: pac::bdma::Dma, ch: u8) -> bool { 243 pub unsafe fn is_running(dma: pac::bdma::Dma, ch: u8) -> bool {
244 let ch = dma.ch(ch as _); 244 let ch = dma.ch(ch as _);
245 ch.cr().read().en() 245 ch.cr().read().en()
246 } 246 }
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! {
149 unsafe {low_level_api::request_stop(&crate::pac::$dma_peri, $channel_num);} 149 unsafe {low_level_api::request_stop(&crate::pac::$dma_peri, $channel_num);}
150 } 150 }
151 151
152 fn is_stopped(&self) -> bool { 152 fn is_running(&self) -> bool {
153 unsafe {low_level_api::is_stopped(&crate::pac::$dma_peri, $channel_num)} 153 unsafe {low_level_api::is_running(&crate::pac::$dma_peri, $channel_num)}
154 } 154 }
155 155
156 fn remaining_transfers(&mut self) -> u16 { 156 fn remaining_transfers(&mut self) -> u16 {
@@ -240,7 +240,7 @@ mod low_level_api {
240 } 240 }
241 241
242 /// Gets the running status of the channel 242 /// Gets the running status of the channel
243 pub unsafe fn is_stopped(dma: &pac::dma::Dma, ch: u8) -> bool { 243 pub unsafe fn is_running(dma: &pac::dma::Dma, ch: u8) -> bool {
244 // get a handle on the channel itself 244 // get a handle on the channel itself
245 let ch = dma.st(ch as _); 245 let ch = dma.st(ch as _);
246 246
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 {
49 fn request_stop(&mut self); 49 fn request_stop(&mut self);
50 50
51 /// Returns whether this channel is active or stopped. 51 /// Returns whether this channel is active or stopped.
52 fn is_stopped(&self) -> bool; 52 fn is_running(&self) -> bool;
53 53
54 /// Returns the total number of remaining transfers. 54 /// Returns the total number of remaining transfers.
55 fn remaining_transfers(&mut self) -> u16; 55 fn remaining_transfers(&mut self) -> u16;
@@ -173,10 +173,10 @@ mod transfers {
173 173
174 // TODO in the future, error checking could be added so that this function returns an error 174 // TODO in the future, error checking could be added so that this function returns an error
175 175
176 if channel.is_stopped() { 176 if channel.is_running() {
177 Poll::Ready(())
178 } else {
179 Poll::Pending 177 Poll::Pending
178 } else {
179 Poll::Ready(())
180 } 180 }
181 }) 181 })
182 .await 182 .await