stm32/dma: add MuxChannel trait to distinguish DMAMUX1 and DMAMUX2 channels.

This commit is contained in:
Dario Nieuwenhuis
2021-07-17 07:49:49 +02:00
parent 54b5012c56
commit 3655048e0f
5 changed files with 37 additions and 14 deletions

View File

@ -172,13 +172,19 @@ crate::pac::peripheral_pins!(
macro_rules! impl_dma {
($inst:ident, {dmamux: $dmamux:ident}, $signal:ident, $request:expr) => {
impl<T: crate::dma::Channel> sealed::$signal<peripherals::$inst> for T {
impl<T> sealed::$signal<peripherals::$inst> for T
where
T: crate::dma::MuxChannel<Mux = crate::dma::$dmamux>,
{
fn request(&self) -> dma::Request {
$request
}
}
impl<T: crate::dma::Channel> $signal<peripherals::$inst> for T {}
impl<T> $signal<peripherals::$inst> for T where
T: crate::dma::MuxChannel<Mux = crate::dma::$dmamux>
{
}
};
($inst:ident, {channel: $channel:ident}, $signal:ident, $request:expr) => {
impl sealed::$signal<peripherals::$inst> for peripherals::$channel {