From 604a25ec5de6f8007f9ad61f315ea03d0d292829 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Tue, 13 Jul 2021 10:46:31 -0400 Subject: [PATCH] Reduce number of traits and impls. --- embassy-stm32/src/bdma/mod.rs | 46 ++++++++--------------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/embassy-stm32/src/bdma/mod.rs b/embassy-stm32/src/bdma/mod.rs index b94563e3..8448185a 100644 --- a/embassy-stm32/src/bdma/mod.rs +++ b/embassy-stm32/src/bdma/mod.rs @@ -394,46 +394,20 @@ pac::interrupts! { #[cfg(usart)] use crate::usart; -#[cfg(not(dmamux))] -pac::peripheral_dma_channels! { - ($peri:ident, usart, $kind:ident, RX, $channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { - impl usart::RxDma for crate::peripherals::$channel_peri { } - impl usart::sealed::RxDma for crate::peripherals::$channel_peri { } - }; - - ($peri:ident, usart, $kind:ident, TX, $channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { - impl usart::TxDma for crate::peripherals::$channel_peri { } - impl usart::sealed::TxDma for crate::peripherals::$channel_peri { } - }; - - ($peri:ident, uart, $kind:ident, RX, $channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { - impl usart::RxDma for crate::peripherals::$channel_peri { } - impl usart::sealed::RxDma for crate::peripherals::$channel_peri { } - }; - - ($peri:ident, uart, $kind:ident, TX, $channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { - impl usart::TxDma for crate::peripherals::$channel_peri { } - impl usart::sealed::TxDma for crate::peripherals::$channel_peri { } - }; -} - -#[cfg(dmamux)] pac::peripherals! { (usart, $peri:ident) => { - pac::bdma_channels! { - ($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { - impl usart::TxDma for crate::peripherals::$channel_peri { } - impl usart::sealed::TxDma for crate::peripherals::$channel_peri { } - }; - } + impl> usart::TxDma for T {} + impl> usart::sealed::TxDma for T {} + + impl> usart::RxDma for T {} + impl> usart::sealed::RxDma for T {} }; (uart, $peri:ident) => { - pac::bdma_channels! { - ($channel_peri:ident, $dma_peri:ident, $channel_num:expr) => { - impl usart::TxDma for crate::peripherals::$channel_peri { } - impl usart::sealed::TxDma for crate::peripherals::$channel_peri { } - }; - } + impl> usart::TxDma for T {} + impl> usart::sealed::TxDma for T {} + + impl> usart::RxDma for T {} + impl> usart::sealed::RxDma for T {} }; }