F0: usart + DMA working
This commit is contained in:
committed by
Bob McWhirter
parent
a56ddfdc04
commit
91521a86a0
@ -78,7 +78,6 @@ pub(crate) async unsafe fn transfer_p2m(
|
||||
})
|
||||
.await;
|
||||
|
||||
on_drop.defuse();
|
||||
// TODO handle error
|
||||
assert!(res == CH_STATUS_COMPLETED);
|
||||
}
|
||||
@ -128,7 +127,6 @@ pub(crate) async unsafe fn transfer_m2p(
|
||||
})
|
||||
.await;
|
||||
|
||||
on_drop.defuse();
|
||||
// TODO handle error
|
||||
assert!(res == CH_STATUS_COMPLETED);
|
||||
}
|
||||
@ -150,7 +148,6 @@ unsafe fn on_irq() {
|
||||
STATE.ch_wakers[n].wake();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -162,6 +159,13 @@ pub(crate) unsafe fn init() {
|
||||
crate::interrupt::$irq::steal().enable();
|
||||
};
|
||||
}
|
||||
pac::peripherals! {
|
||||
(bdma, DMA1) => {
|
||||
critical_section::with(|_| {
|
||||
pac::RCC.ahbenr().modify(|w| w.set_dmaen(true));
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
@ -285,3 +289,17 @@ pac::interrupts! {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(usart)]
|
||||
use crate::usart;
|
||||
pac::peripheral_dma_channels! {
|
||||
($peri:ident, usart, $kind:ident, RX, $channel_peri:ident, $dma_peri:ident, $channel_num:expr) => {
|
||||
impl usart::RxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }
|
||||
impl usart::sealed::RxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }
|
||||
};
|
||||
|
||||
($peri:ident, usart, $kind:ident, TX, $channel_peri:ident, $dma_peri:ident, $channel_num:expr) => {
|
||||
impl usart::TxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }
|
||||
impl usart::sealed::TxDma<crate::peripherals::$peri> for crate::peripherals::$channel_peri { }
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user