Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setupI2S() {
- i2s_config_t cfg = {
- .mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_TX),
- .sample_rate = SAMPLE_RATE,
- .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
- .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
- .communication_format = I2S_COMM_FORMAT_I2S,
- .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
- .dma_buf_count = DMA_BUF_COUNT,
- .dma_buf_len = DMA_BUF_LEN,
- .use_apll = true,
- .tx_desc_auto_clear = false
- };
- i2s_pin_config_t pins = {
- .bck_io_num = I2S_BCLK_PIN,
- .ws_io_num = I2S_LRC_PIN,
- .data_out_num = I2S_DOUT_PIN,
- .data_in_num = I2S_PIN_NO_CHANGE
- };
- i2s_driver_install(I2S_PORT, &cfg, 0, nullptr);
- i2s_set_pin(I2S_PORT, &pins);
- i2s_set_clk(I2S_PORT, SAMPLE_RATE, I2S_BITS_PER_SAMPLE_16BIT, I2S_CHANNEL_STEREO);
- i2s_zero_dma_buffer(I2S_PORT);
- i2s_start(I2S_PORT);
- logMsg("[I2S] ready");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement