Protect DMA-related things with cfg.
This commit is contained in:
parent
2a25de3d3e
commit
07a6686879
@ -26,6 +26,8 @@ pub enum Error {
|
|||||||
|
|
||||||
pub(crate) mod sealed {
|
pub(crate) mod sealed {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[cfg(dma)]
|
||||||
use crate::dma::WriteDma;
|
use crate::dma::WriteDma;
|
||||||
|
|
||||||
pub trait Instance {
|
pub trait Instance {
|
||||||
@ -47,8 +49,10 @@ pub(crate) mod sealed {
|
|||||||
fn af_num(&self) -> u8;
|
fn af_num(&self) -> u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(dma)]
|
||||||
pub trait RxDma<T: Instance> {}
|
pub trait RxDma<T: Instance> {}
|
||||||
|
|
||||||
|
#[cfg(dma)]
|
||||||
pub trait TxDma<T: Instance>: WriteDma<T> {}
|
pub trait TxDma<T: Instance>: WriteDma<T> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +63,9 @@ pub trait CtsPin<T: Instance>: sealed::CtsPin<T> {}
|
|||||||
pub trait RtsPin<T: Instance>: sealed::RtsPin<T> {}
|
pub trait RtsPin<T: Instance>: sealed::RtsPin<T> {}
|
||||||
pub trait CkPin<T: Instance>: sealed::CkPin<T> {}
|
pub trait CkPin<T: Instance>: sealed::CkPin<T> {}
|
||||||
|
|
||||||
|
#[cfg(dma)]
|
||||||
pub trait RxDma<T: Instance>: sealed::RxDma<T> {}
|
pub trait RxDma<T: Instance>: sealed::RxDma<T> {}
|
||||||
|
#[cfg(dma)]
|
||||||
pub trait TxDma<T: Instance>: sealed::TxDma<T> {}
|
pub trait TxDma<T: Instance>: sealed::TxDma<T> {}
|
||||||
|
|
||||||
crate::pac::peripherals!(
|
crate::pac::peripherals!(
|
||||||
|
@ -104,13 +104,8 @@ impl<'d, T: Instance> Uart<'d, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(dma_v2)]
|
#[cfg(dma)]
|
||||||
pub async fn write_dma(
|
pub async fn write_dma(&mut self, ch: &mut impl TxDma<T>, buffer: &[u8]) -> Result<(), Error> {
|
||||||
&mut self,
|
|
||||||
//ch: &mut impl crate::dma::Channel,
|
|
||||||
ch: &mut impl TxDma<T>,
|
|
||||||
buffer: &[u8],
|
|
||||||
) -> Result<(), Error> {
|
|
||||||
unsafe {
|
unsafe {
|
||||||
self.inner.regs().cr3().modify(|reg| {
|
self.inner.regs().cr3().modify(|reg| {
|
||||||
reg.set_dmat(true);
|
reg.set_dmat(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user