aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/dma/mod.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/embassy-stm32/src/dma/mod.rs b/embassy-stm32/src/dma/mod.rs
index 974b95f2f..54eed9d4c 100644
--- a/embassy-stm32/src/dma/mod.rs
+++ b/embassy-stm32/src/dma/mod.rs
@@ -20,26 +20,24 @@ pub(crate) mod sealed {
20 fn ch_num(&self) -> u8 { 20 fn ch_num(&self) -> u8 {
21 self.num() % 8 21 self.num() % 8
22 } 22 }
23 23 fn regs(&self) -> pac::dma::Dma;
24 fn regs(&self) -> pac::dma::Dma {
25 match self.dma_num() {
26 0 => pac::DMA1,
27 _ => pac::DMA2,
28 }
29 }
30 } 24 }
31} 25}
32 26
33pub trait Channel: sealed::Channel + Sized {} 27pub trait Channel: sealed::Channel + Sized {}
34 28
35macro_rules! impl_dma_channel { 29macro_rules! impl_dma_channel {
36 ($type:ident, $dma_num:expr, $ch_num:expr) => { 30 ($name:ident, $type:ident, $dma_num:expr, $ch_num:expr) => {
37 impl crate::dma::Channel for peripherals::$type {} 31 impl crate::dma::Channel for peripherals::$type {}
38 impl crate::dma::sealed::Channel for peripherals::$type { 32 impl crate::dma::sealed::Channel for peripherals::$type {
39 #[inline] 33 #[inline]
40 fn num(&self) -> u8 { 34 fn num(&self) -> u8 {
41 $dma_num * 8 + $ch_num 35 $dma_num * 8 + $ch_num
42 } 36 }
37
38 fn regs(&self) -> dma::Dma {
39 $name
40 }
43 } 41 }
44 }; 42 };
45} 43}