Use a single hardcoded I2S config, tested working
Tested working i2s config for both I2S and I2SNoDac, only have the one copy for later refactor into optional configuration.
This commit is contained in:
1 parent
e8e7acb884
commit
7a7f8bf449
1 file changed
+5
-20
@@ -28,24 +28,9 @@
|
||||
|
||||
|
||||
#ifdef ESP32
|
||||
i2s_config_t i2s_config = {
|
||||
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX),
|
||||
.sample_rate = 44100,
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
|
||||
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
|
||||
.communication_format = (i2s_comm_format_t)I2S_COMM_FORMAT_I2S_MSB,
|
||||
.intr_alloc_flags = 0, // default interrupt priority
|
||||
.dma_buf_count = 8,
|
||||
.dma_buf_len = 64,
|
||||
.use_apll = 1
|
||||
};
|
||||
|
||||
i2s_pin_config_t pin_config = {
|
||||
.bck_io_num = 26, //this is BCK pin
|
||||
.ws_io_num = 25, // this is LRCK pin
|
||||
.data_out_num = 22, // this is DATA output pin
|
||||
.data_in_num = -1 //Not used
|
||||
};
|
||||
extern int i2s_num;
|
||||
extern i2s_config_t i2s_config_dac;
|
||||
extern i2s_pin_config_t pin_config_dac;
|
||||
#endif
|
||||
|
||||
bool AudioOutputI2SNoDAC::i2sOn = false;
|
||||
@@ -56,8 +41,8 @@ AudioOutputI2SNoDAC::AudioOutputI2SNoDAC()
|
||||
if (!i2sOn) {
|
||||
//initialize i2s with configurations above
|
||||
|
||||
i2s_driver_install((i2s_port_t)0, &i2s_config, 0, NULL);
|
||||
i2s_set_pin((i2s_port_t)0, &pin_config);
|
||||
i2s_driver_install((i2s_port_t)i2s_num, &i2s_config_dac, 0, NULL);
|
||||
i2s_set_pin((i2s_port_t)i2s_num, &pin_config_dac);
|
||||
}
|
||||
#else
|
||||
if (!i2sOn) i2s_begin();
|
||||
|
||||
Reference in new issue
Block a user