Skip to main content

for_each_i2s

Macro for_each_i2s 

Source
macro_rules! for_each_i2s {
    ($($pattern:tt => $code:tt;)*) => { ... };
}
Available on crate feature _device-selected only.
Expand description

This macro can be used to generate code for each peripheral instance of the I2S driver.

For an explanation on the general syntax, as well as usage of individual/repeated matchers, refer to the crate-level documentation.

This macro has one option for its “Individual matcher” case:

Syntax: ($instance:ident, $sys:ident, $mclk:ident, $bclk:ident, $ws:ident, $bclk_rx:ident, $ws_rx:ident, [$($dout:ident),*], [$($din:ident),*], $pdm_tx:literal, $pdm_rx:literal, $pcm2pdm:literal, $pdm2pcm:literal)

Macro fragments:

  • $instance: the name of the I2S instance
  • $sys: the name of the instance as it is in the esp_hal::system::Peripheral enum.
  • $mclk: the MCLK output signal (a placeholder on chips without a GPIO-matrix MCLK).
  • $bclk, $ws: TX bit clock and word select output signals.
  • $bclk_rx, $ws_rx: RX bit clock and word select output signals.
  • $dout, $din: data-out and data-in signal names.
  • $pdm_tx, $pdm_rx: whether the instance supports PDM TX/RX.
  • $pcm2pdm, $pdm2pcm: whether the instance supports the hardware PCM<->PDM format conversion filter on TX/RX.

Example data:

  • (I2S0, I2s0, I2S_MCLK, I2SO_BCK, I2SO_WS, I2SI_BCK, I2SI_WS, [I2SO_SD], [I2SI_SD], true, true, true, true)