] {}
}
};
}
impl_channel!(0);
#[cfg(not(esp32c2))]
impl_channel!(1);
#[cfg(not(esp32c2))]
impl_channel!(2);
#[cfg(esp32s3)]
impl_channel!(3);
#[cfg(esp32s3)]
impl_channel!(4);
/// GDMA Peripheral
///
/// This offers the available DMA channels.
pub struct Gdma<'d> {
_inner: PeripheralRef<'d, crate::peripherals::DMA>,
pub channel0: ChannelCreator0,
#[cfg(not(esp32c2))]
pub channel1: ChannelCreator1,
#[cfg(not(esp32c2))]
pub channel2: ChannelCreator2,
#[cfg(esp32s3)]
pub channel3: ChannelCreator3,
#[cfg(esp32s3)]
pub channel4: ChannelCreator4,
}
impl<'d> Gdma<'d> {
/// Create a DMA instance.
pub fn new(
dma: impl crate::peripheral::Peripheral + 'd,
peripheral_clock_control: &mut PeripheralClockControl,
) -> Gdma<'d> {
crate::into_ref!(dma);
peripheral_clock_control.enable(Peripheral::Gdma);
dma.misc_conf.modify(|_, w| w.ahbm_rst_inter().set_bit());
dma.misc_conf.modify(|_, w| w.ahbm_rst_inter().clear_bit());
dma.misc_conf.modify(|_, w| w.clk_en().set_bit());
Gdma {
_inner: dma,
channel0: ChannelCreator0 {},
#[cfg(not(esp32c2))]
channel1: ChannelCreator1 {},
#[cfg(not(esp32c2))]
channel2: ChannelCreator2 {},
#[cfg(esp32s3)]
channel3: ChannelCreator3 {},
#[cfg(esp32s3)]
channel4: ChannelCreator4 {},
}
}
}