不一定能用,要看你那边的模式,我这边是 SLAVE 模式的。
Code: Select all
#define MY_I2S_CFG() { \
.type = AUDIO_STREAM_READER, \
.i2s_config = { \
.mode = (i2s_mode_t)(I2S_MODE_SLAVE | I2S_MODE_RX | I2S_MODE_TX), \
.sample_rate = 48000, \
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, \
.bits_per_chan = I2S_BITS_PER_CHAN_16BIT, \
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, \
.communication_format = I2S_COMM_FORMAT_STAND_I2S, \
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2, \
.dma_buf_count = 3, \
.dma_buf_len = 300, \
.use_apll = false, \
.tx_desc_auto_clear = true, \
.fixed_mclk = 0 \
}, \
.i2s_port = I2S_NUM_0, \
.use_alc = false, \
.volume = 0, \
.out_rb_size = I2S_STREAM_RINGBUFFER_SIZE, \
.task_stack = I2S_STREAM_TASK_STACK, \
.task_core = I2S_STREAM_TASK_CORE, \
.task_prio = I2S_STREAM_TASK_PRIO, \
.stack_in_ext = false, \
.multi_out_num = 0, \
.uninstall_drv = false, \
.need_expand = false, \
.expand_src_bits = I2S_BITS_PER_SAMPLE_16BIT, \
}