EasyManua.ls Logo

Espressif ESP32-S2 - Page 313

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, uint32_t bits_cfg, i2s_channel_t ch)
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
Return
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
ESP_ERR_NO_MEM Out of memory
Parameters
i2s_num: I2S port number
rate: I2S sample rate (ex: 8000, 44100)
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 (seei2s_bits_per_chan_t
) high 16bits =0 means same as the bits per sample.
ch: I2S channel, (I2S_CHANNEL_MONO, I2S_CHANNEL_STEREO or specific channel in
TDM mode)
float i2s_get_clk(i2s_port_t i2s_num)
get clock set on particular port number.
Return
actual clock set by i2s driver
Parameters
i2s_num: I2S port number
Structures
struct i2s_pin_config_t
I2S pin number for i2s_set_pin.
Public Members
int mck_io_num
MCK in out pin
int bck_io_num
BCK in out pin
int ws_io_num
WS in out pin
int data_out_num
DATA out pin
int data_in_num
DATA in pin
struct i2s_driver_config_t
I2S driver configuration parameters.
Public Members
i2s_mode_t mode
I2S work mode
uint32_t sample_rate
I2S sample rate
Espressif Systems 302
Submit Document Feedback
Release v4.4

Table of Contents