Skip to main content

esp_hal/i2s/
mod.rs

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