diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs index 08be583c..a75793f8 100644 --- a/embassy-stm32/src/usart/mod.rs +++ b/embassy-stm32/src/usart/mod.rs @@ -26,6 +26,8 @@ pub enum Error { pub(crate) mod sealed { use super::*; + + #[cfg(dma)] use crate::dma::WriteDma; pub trait Instance { @@ -47,8 +49,10 @@ pub(crate) mod sealed { fn af_num(&self) -> u8; } + #[cfg(dma)] pub trait RxDma {} + #[cfg(dma)] pub trait TxDma: WriteDma {} } @@ -59,7 +63,9 @@ pub trait CtsPin: sealed::CtsPin {} pub trait RtsPin: sealed::RtsPin {} pub trait CkPin: sealed::CkPin {} +#[cfg(dma)] pub trait RxDma: sealed::RxDma {} +#[cfg(dma)] pub trait TxDma: sealed::TxDma {} crate::pac::peripherals!( diff --git a/embassy-stm32/src/usart/v1.rs b/embassy-stm32/src/usart/v1.rs index 1f05dc9a..37b325d8 100644 --- a/embassy-stm32/src/usart/v1.rs +++ b/embassy-stm32/src/usart/v1.rs @@ -104,13 +104,8 @@ impl<'d, T: Instance> Uart<'d, T> { } } - #[cfg(dma_v2)] - pub async fn write_dma( - &mut self, - //ch: &mut impl crate::dma::Channel, - ch: &mut impl TxDma, - buffer: &[u8], - ) -> Result<(), Error> { + #[cfg(dma)] + pub async fn write_dma(&mut self, ch: &mut impl TxDma, buffer: &[u8]) -> Result<(), Error> { unsafe { self.inner.regs().cr3().modify(|reg| { reg.set_dmat(true);