Skip to content

Commit e434ba8

Browse files
committed
I2S PT8211 config for ESP32
1 parent 1073c43 commit e434ba8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal/MozziGuts_impl_ESP32.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ namespace MozziPrivate {
8181
size_t bytes_written;
8282
//i2s_write(i2s_num, &_esp32_prev_sample, ESP_SAMPLE_SIZE, &bytes_written, 0);
8383
#if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_I2S_DAC) || MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PDM_VIA_I2S)
84-
i2s_channel_write(tx_handle,&_esp32_prev_sample, ESP_SAMPLE_SIZE, &bytes_written, 0);
85-
84+
i2s_channel_write(tx_handle,_esp32_prev_sample, sizeof(_esp32_prev_sample[0]), &bytes_written, 0);// TODO STEREO
8685
#elif MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_INTERNAL_DAC)
8786
dac_continuous_write(dac_handle, _esp32_prev_sample, ESP_SAMPLE_SIZE, &bytes_written, 0);
8887
/*uint8_t tt = 120;
@@ -97,7 +96,6 @@ namespace MozziPrivate {
9796
inline bool canBufferAudioOutput() {
9897
if (_esp32_can_buffer_next) return true;
9998
_esp32_can_buffer_next = esp32_tryWriteSample();
100-
//if(_esp32_can_buffer_next) digitalWrite(2,!digitalRead(2));
10199
return _esp32_can_buffer_next;
102100
}
103101

@@ -171,17 +169,18 @@ namespace MozziPrivate {
171169
//static const i2s_config_t i2s_config = {
172170
i2s_std_config_t std_cfg = {
173171
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(MOZZI_AUDIO_RATE),
174-
.slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(ESP_SAMPLE_SIZE, I2S_SLOT_MODE_STEREO), // TODO: add between the different modes?
172+
.slot_cfg = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(ESP_SAMPLE_SIZE, I2S_SLOT_MODE_MONO), // TODO: add between the different modes? AND STEREO
173+
//.slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(ESP_SAMPLE_SIZE, I2S_SLOT_MODE_MONO),
175174
.gpio_cfg = {
176-
.mclk = I2S_GPIO_UNUSED,
175+
.mclk = gpio_num_t(MOZZI_I2S_PIN_MCLK),
177176
.bclk = gpio_num_t(MOZZI_I2S_PIN_BCK),
178177
.ws = gpio_num_t(MOZZI_I2S_PIN_WS),
179178
.dout = gpio_num_t(MOZZI_I2S_PIN_DATA),
180179
.din = I2S_GPIO_UNUSED,
181180
.invert_flags = {
182181
.mclk_inv = false,
183182
.bclk_inv = false,
184-
.ws_inv = false,
183+
.ws_inv = true,
185184
},
186185
},
187186

0 commit comments

Comments
 (0)