You should be able to re-purpose one of the DAC GPIOs for something else. For instance, this only uses DAC2:
Code: Select all
i2s_config_t cfg={
.mode=I2S_MODE_DAC_BUILT_IN|I2S_MODE_TX|I2S_MODE_MASTER,
.sample_rate=rate,
.bits_per_sample=16,
.channel_format=I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format=I2S_COMM_FORMAT_I2S_MSB,
.intr_alloc_flags=0,
.dma_buf_count=4,
.dma_buf_len=buffsize/4
};
i2s_driver_install(0, &cfg, 4, &soundQueue);
i2s_set_pin(0, NULL);
i2s_set_dac_mode(I2S_DAC_CHANNEL_LEFT_EN);
i2s_set_sample_rates(0, cfg.sample_rate);
//I2S enables *both* DAC channels; we only need DAC2. DAC1 is connected to the select button.
CLEAR_PERI_REG_MASK(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_DAC_XPD_FORCE_M);
CLEAR_PERI_REG_MASK(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_XPD_DAC_M);
Not sure if the last two lines are still needed, the I2S driver may have taken care of that by itself now.