esp_hal/i2s/
mod.rs

1//! # Inter-IC Sound (I2S)
2
3use crate::dma::DmaEligible;
4
5pub mod master;
6
7#[cfg(esp32)]
8pub mod parallel;
9
10crate::any_peripheral! {
11    /// Any I2S peripheral.
12    pub peripheral AnyI2s<'d> {
13        #[cfg(i2s0)]
14        I2s0(crate::peripherals::I2S0<'d>),
15        #[cfg(i2s1)]
16        I2s1(crate::peripherals::I2S1<'d>),
17    }
18}
19
20impl<'d> DmaEligible for AnyI2s<'d> {
21    #[cfg(gdma)]
22    type Dma = crate::dma::AnyGdmaChannel<'d>;
23    #[cfg(pdma)]
24    type Dma = crate::dma::AnyI2sDmaChannel<'d>;
25
26    fn dma_peripheral(&self) -> crate::dma::DmaPeripheral {
27        match &self.0 {
28            AnyI2sInner::I2s0(_) => crate::dma::DmaPeripheral::I2s0,
29            #[cfg(i2s1)]
30            AnyI2sInner::I2s1(_) => crate::dma::DmaPeripheral::I2s1,
31        }
32    }
33}