Function esp_idf_hal::sys::i2s_set_clk
source · pub unsafe extern "C" fn i2s_set_clk(
i2s_num: u32,
rate: u32,
bits_cfg: u32,
ch: i32,
) -> i32
Expand description
@brief Set clock & bit width used for I2S RX and TX.
Similar to i2s_set_sample_rates(), but also sets bit width.
- stop i2s;
- calculate mclk, bck, bck_factor
- malloc dma buffer;
- 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