aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-11-13 16:53:50 +0000
committerGitHub <[email protected]>2023-11-13 16:53:50 +0000
commitea99671729be91b63156097b01128c3ea6f74a75 (patch)
tree7771026e61135b039f1426b1224b68aa0294edbd
parentcdcd3e26ddcd4504d28492eba2810367da9c3e81 (diff)
parent8eff7498238ca8863bfdd4496fcb4246cc2df8eb (diff)
Merge pull request #2180 from MaxiluxSystems/gpdma-drop-fix
stm32/gpdma: fix drop() to use documented method for aborting transfer
-rw-r--r--embassy-stm32/src/dma/gpdma.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs
index b811da1fb..b061415eb 100644
--- a/embassy-stm32/src/dma/gpdma.rs
+++ b/embassy-stm32/src/dma/gpdma.rs
@@ -299,19 +299,15 @@ impl<'a, C: Channel> Transfer<'a, C> {
299 299
300 pub fn request_stop(&mut self) { 300 pub fn request_stop(&mut self) {
301 let ch = self.channel.regs().ch(self.channel.num()); 301 let ch = self.channel.regs().ch(self.channel.num());
302 302 ch.cr().modify(|w| {
303 // Disable the channel. Keep the IEs enabled so the irqs still fire. 303 w.set_susp(true);
304 ch.cr().write(|w| {
305 w.set_tcie(true);
306 w.set_useie(true);
307 w.set_dteie(true);
308 w.set_suspie(true);
309 }) 304 })
310 } 305 }
311 306
312 pub fn is_running(&mut self) -> bool { 307 pub fn is_running(&mut self) -> bool {
313 let ch = self.channel.regs().ch(self.channel.num()); 308 let ch = self.channel.regs().ch(self.channel.num());
314 !ch.sr().read().tcf() 309 let sr = ch.sr().read();
310 !sr.tcf() && !sr.suspf()
315 } 311 }
316 312
317 /// Gets the total remaining transfers for the channel 313 /// Gets the total remaining transfers for the channel