Skip to main content

esp_hal/i2s/
mod.rs

1//! # Inter-IC Sound (I2S)
2
3pub mod master;
4
5#[cfg(any(i2s_supports_pdm_tx, i2s_supports_pdm_rx))]
6pub mod pdm;
7
8#[cfg(esp32)]
9pub mod parallel;
10
11crate::any_peripheral! {
12    /// Any I2S peripheral.
13    pub peripheral AnyI2s<'d> {
14        #[cfg(soc_has_i2s0)]
15        I2s0(crate::peripherals::I2S0<'d>),
16        #[cfg(soc_has_i2s1)]
17        I2s1(crate::peripherals::I2S1<'d>),
18        #[cfg(soc_has_i2s2)]
19        I2s2(crate::peripherals::I2S2<'d>),
20    }
21}
22
23with_i2s_dma_engine! {
24    ($engine:tt, $any_ch:ident) => {
25        use crate::dma::DmaEligiblePeripheral;
26
27        impl<'d> DmaEligiblePeripheral<crate::dma::$any_ch<'d>> for AnyI2s<'d> {
28            fn dma_peripheral(&self) -> crate::dma::DmaPeripheral {
29                any::delegate!(self, i2s => { i2s.dma_peripheral() })
30            }
31        }
32    };
33}