aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuliDi <[email protected]>2023-06-22 10:43:45 +0200
committerJuliDi <[email protected]>2023-06-22 10:43:45 +0200
commit8d0095c61808b88ad95349c7f24e91797d93dc83 (patch)
tree6ee86c48d19c7d308735f860170380e43ac182c1
parentfdb3c3d6ffad31ffc61c66d0d8a6f4db70a1c32b (diff)
add option to enable/disable complete transfer interrupt
-rw-r--r--embassy-stm32/src/dma/bdma.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs
index 162ca9adb..32b75bb68 100644
--- a/embassy-stm32/src/dma/bdma.rs
+++ b/embassy-stm32/src/dma/bdma.rs
@@ -22,8 +22,12 @@ use crate::pac::bdma::{regs, vals};
22#[cfg_attr(feature = "defmt", derive(defmt::Format))] 22#[cfg_attr(feature = "defmt", derive(defmt::Format))]
23#[non_exhaustive] 23#[non_exhaustive]
24pub struct TransferOptions { 24pub struct TransferOptions {
25 /// Enable circular DMA
25 pub circular: bool, 26 pub circular: bool,
27 /// Enable half transfer interrupt
26 pub half_transfer_ir: bool, 28 pub half_transfer_ir: bool,
29 /// Enable transfer complete interrupt
30 pub complete_transfer_ir: bool,
27} 31}
28 32
29impl Default for TransferOptions { 33impl Default for TransferOptions {
@@ -31,6 +35,7 @@ impl Default for TransferOptions {
31 Self { 35 Self {
32 circular: false, 36 circular: false,
33 half_transfer_ir: false, 37 half_transfer_ir: false,
38 complete_transfer_ir: false,
34 } 39 }
35 } 40 }
36} 41}
@@ -289,7 +294,7 @@ impl<'a, C: Channel> Transfer<'a, C> {
289 } 294 }
290 w.set_dir(dir.into()); 295 w.set_dir(dir.into());
291 w.set_teie(true); 296 w.set_teie(true);
292 w.set_tcie(true); 297 w.set_tcie(options.complete_transfer_ir);
293 w.set_htie(options.half_transfer_ir); 298 w.set_htie(options.half_transfer_ir);
294 if options.circular { 299 if options.circular {
295 w.set_circ(vals::Circ::ENABLED); 300 w.set_circ(vals::Circ::ENABLED);