Function esp_idf_sys::i2s_set_clk

source ·
pub unsafe extern "C" fn i2s_set_clk(
    i2s_num: i2s_port_t,
    rate: u32,
    bits_cfg: u32,
    ch: i2s_channel_t
) -> esp_err_t
Expand description

@brief Set clock & bit width used for I2S RX and TX.

Similar to i2s_set_sample_rates(), but also sets bit width.

  1. stop i2s;
  2. calculate mclk, bck, bck_factor
  3. malloc dma buffer;
  4. start i2s

@param i2s_num I2S port number

@param rate I2S sample rate (ex: 8000, 44100…)

@param bits_cfg I2S bits configuration the low 16 bits is for data bits per sample in one channel (see ‘i2s_bits_per_sample_t’) the high 16 bits is for total bits in one channel (see ‘i2s_bits_per_chan_t’) high 16bits =0 means same as the bits per sample.

@param ch I2S channel, (I2S_CHANNEL_MONO, I2S_CHANNEL_STEREO or specific channel in TDM mode)

@return - ESP_OK Success - ESP_ERR_INVALID_ARG Parameter error - ESP_ERR_NO_MEM Out of memory