diff --git a/_i2_s_e_s_p32_v1_8h_source.html b/_i2_s_e_s_p32_v1_8h_source.html
index 3dea25c01..a6743c341 100644
--- a/_i2_s_e_s_p32_v1_8h_source.html
+++ b/_i2_s_e_s_p32_v1_8h_source.html
@@ -82,122 +82,122 @@
11 #include "driver/i2s_tdm.h"
12 #include "esp_system.h"
- 14 #define IS_I2S_IMPLEMENTED
+ 14 #define IS_I2S_IMPLEMENTED
-
-
-
-
-
-
-
-
-
-
-
-
- 37 if (info.
equals(cfg))
return true;
-
-
- 40 LOGI(
"i2s_set_sample_rates: %d", (
int)info.
sample_rate);
- 41 return getDriver(cfg).changeSampleRate(cfg, rx_chan, tx_chan);
-
-
-
-
-
-
-
-
-
- 54 bool begin() {
return (!is_started) ?
begin(cfg) :
true; }
-
-
-
-
-
-
- 62 if (is_started)
end();
-
-
-
- 66 return begin(cfg, cfg.pin_data, I2S_GPIO_UNUSED);
-
-
-
- 70 return begin(cfg, I2S_GPIO_UNUSED,
- 71 cfg.pin_data_rx != I2S_GPIO_UNUSED ? cfg.pin_data_rx
-
-
- 74 return begin(cfg, cfg.pin_data, cfg.pin_data_rx);
-
- 76 LOGE(
"Did not expect go get here");
-
-
- 80 int available() {
return I2S_BUFFER_COUNT * I2S_BUFFER_SIZE; }
-
-
-
-
-
- 88 if (rx_chan !=
nullptr) {
- 89 i2s_channel_disable(rx_chan);
- 90 i2s_del_channel(rx_chan);
-
-
- 93 if (tx_chan !=
nullptr) {
- 94 i2s_channel_disable(tx_chan);
- 95 i2s_del_channel(tx_chan);
-
-
-
-
-
-
-
-
-
-
-
- 109 assert(tx_chan !=
nullptr);
- 110 if (i2s_channel_write(tx_chan, src, size_bytes, &result,
- 111 ticks_to_wait_write) != ESP_OK) {
-
-
-
-
-
- 117 size_t readBytes(
void *dest,
size_t size_bytes) {
-
- 119 if (i2s_channel_read(rx_chan, dest, size_bytes, &result,
- 120 ticks_to_wait_read) != ESP_OK) {
-
-
-
-
-
- 126 void setWaitTimeReadMs(TickType_t ms) {
- 127 ticks_to_wait_read = pdMS_TO_TICKS(ms);
-
- 129 void setWaitTimeWriteMs(TickType_t ms) {
- 130 ticks_to_wait_write = pdMS_TO_TICKS(ms);
-
-
-
-
- 135 i2s_std_config_t i2s_config;
- 136 i2s_chan_handle_t tx_chan =
nullptr;
- 137 i2s_chan_handle_t rx_chan =
nullptr;
- 138 bool is_started =
false;
- 139 TickType_t ticks_to_wait_read = portMAX_DELAY;
- 140 TickType_t ticks_to_wait_write = portMAX_DELAY;
-
-
-
-
- 145 i2s_chan_handle_t &tx_chan,
- 146 i2s_chan_handle_t &rx_chan,
int txPin,
-
+
+
+
+
+
+
+
+
+
+
+
+ 36 if (info.
equals(cfg))
return true;
+
+
+ 39 LOGI(
"i2s_set_sample_rates: %d", (
int)info.
sample_rate);
+ 40 return getDriver(cfg).changeSampleRate(cfg, rx_chan, tx_chan);
+
+
+
+
+
+
+
+
+
+ 53 bool begin() {
return (!is_started) ?
begin(cfg) :
true; }
+
+
+
+
+
+
+ 61 if (is_started)
end();
+
+
+
+ 65 return begin(cfg, cfg.pin_data, I2S_GPIO_UNUSED);
+
+
+
+ 69 return begin(cfg, I2S_GPIO_UNUSED,
+ 70 cfg.pin_data_rx != I2S_GPIO_UNUSED ? cfg.pin_data_rx
+
+
+ 73 return begin(cfg, cfg.pin_data, cfg.pin_data_rx);
+
+ 75 LOGE(
"Did not expect go get here");
+
+
+ 79 int available() {
return I2S_BUFFER_COUNT * I2S_BUFFER_SIZE; }
+
+
+
+
+
+ 87 if (rx_chan !=
nullptr) {
+ 88 i2s_channel_disable(rx_chan);
+ 89 i2s_del_channel(rx_chan);
+
+
+ 92 if (tx_chan !=
nullptr) {
+ 93 i2s_channel_disable(tx_chan);
+ 94 i2s_del_channel(tx_chan);
+
+
+
+
+
+
+
+
+
+
+
+ 108 assert(tx_chan !=
nullptr);
+ 109 if (i2s_channel_write(tx_chan, src, size_bytes, &result,
+ 110 ticks_to_wait_write) != ESP_OK) {
+
+
+
+
+
+ 116 size_t readBytes(
void *dest,
size_t size_bytes) {
+
+ 118 if (i2s_channel_read(rx_chan, dest, size_bytes, &result,
+ 119 ticks_to_wait_read) != ESP_OK) {
+
+
+
+
+
+ 125 void setWaitTimeReadMs(TickType_t ms) {
+ 126 ticks_to_wait_read = pdMS_TO_TICKS(ms);
+
+ 128 void setWaitTimeWriteMs(TickType_t ms) {
+ 129 ticks_to_wait_write = pdMS_TO_TICKS(ms);
+
+
+
+
+ 134 i2s_std_config_t i2s_config;
+ 135 i2s_chan_handle_t tx_chan =
nullptr;
+ 136 i2s_chan_handle_t rx_chan =
nullptr;
+ 137 bool is_started =
false;
+ 138 TickType_t ticks_to_wait_read = portMAX_DELAY;
+ 139 TickType_t ticks_to_wait_write = portMAX_DELAY;
+
+
+
+ 143 i2s_chan_handle_t &tx_chan,
+ 144 i2s_chan_handle_t &rx_chan,
int txPin,
+
+
+
150 i2s_chan_handle_t &tx_chan,
@@ -207,381 +207,428 @@
-
-
- 159 i2s_std_slot_config_t result;
- 160 switch (cfg.i2s_format) {
- 161 case I2S_LEFT_JUSTIFIED_FORMAT:
-
- 163 result = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(
-
-
-
-
- 168 result = I2S_STD_PCM_SLOT_DEFAULT_CONFIG(
-
-
-
-
- 173 result = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(
-
-
-
-
-
-
-
- 181 case I2SChannelSelect::Left:
- 182 result.slot_mask = I2S_STD_SLOT_LEFT;
-
- 184 case I2SChannelSelect::Right:
- 185 result.slot_mask = I2S_STD_SLOT_RIGHT;
-
-
- 188 LOGW(
"Using channel_format: I2SChannelSelect::Left for mono");
- 189 result.slot_mask = I2S_STD_SLOT_LEFT;
-
-
-
-
-
-
-
-
-
- 199 i2s_chan_config_t result = I2S_CHANNEL_DEFAULT_CONFIG(
- 200 (i2s_port_t)cfg.port_no,
- 201 cfg.is_master ? I2S_ROLE_MASTER : I2S_ROLE_SLAVE);
-
-
-
- 205 if (size > 0) result.dma_frame_num = size / frame_size;
- 206 LOGI(
"dma_frame_num: %d", (
int)result.dma_frame_num);
- 207 result.auto_clear = cfg.auto_clear;
-
-
-
-
-
- 213 i2s_std_clk_config_t clk_cfg =
- 214 I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)cfg.
sample_rate);
-
- 216 clk_cfg.mclk_multiple = (i2s_mclk_multiple_t) cfg.
mclk_multiple;
-
-
-
- 220 clk_cfg.mclk_multiple = I2S_MCLK_MULTIPLE_384;
- 221 LOGI(
"mclk_multiple=384");
-
-
-
-
-
-
- 228 i2s_chan_handle_t &rx_chan,
int txPin,
int rxPin) {
-
- 230 LOGI(
"tx: %d, rx: %d", txPin, rxPin);
- 231 i2s_std_config_t std_cfg = {
- 232 .clk_cfg = getClockConfig(cfg),
- 233 .slot_cfg = getSlotConfig(cfg),
-
-
- 236 .mclk = (gpio_num_t)cfg.pin_mck,
- 237 .bclk = (gpio_num_t)cfg.pin_bck,
- 238 .ws = (gpio_num_t)cfg.pin_ws,
- 239 .dout = (gpio_num_t)txPin,
- 240 .din = (gpio_num_t)rxPin,
-
-
-
-
-
-
-
-
-
-
- 251 if (i2s_channel_init_std_mode(tx_chan, &std_cfg) != ESP_OK) {
- 252 LOGE(
"i2s_channel_init_std_mode %s",
"tx");
-
-
- 255 if (i2s_channel_enable(tx_chan) != ESP_OK) {
- 256 LOGE(
"i2s_channel_enable %s",
"tx");
-
-
-
+
+ 158 i2s_chan_handle_t &rx_chan,
int txPin,
int rxPin) {
+
+ 160 LOGI(
"tx: %d, rx: %d", txPin, rxPin);
+ 161 i2s_std_config_t std_cfg = {
+ 162 .clk_cfg = getClockConfig(cfg),
+ 163 .slot_cfg = getSlotConfig(cfg),
+
+
+ 166 .mclk = (gpio_num_t)cfg.pin_mck,
+ 167 .bclk = (gpio_num_t)cfg.pin_bck,
+ 168 .ws = (gpio_num_t)cfg.pin_ws,
+ 169 .dout = (gpio_num_t)txPin,
+ 170 .din = (gpio_num_t)rxPin,
+
+
+
+
+
+
+
+
+
+
+ 181 if (i2s_channel_init_std_mode(tx_chan, &std_cfg) != ESP_OK) {
+ 182 LOGE(
"i2s_channel_init_std_mode %s",
"tx");
+
+
+ 185 if (i2s_channel_enable(tx_chan) != ESP_OK) {
+ 186 LOGE(
"i2s_channel_enable %s",
"tx");
+
+
+
+
+
+ 192 if (i2s_channel_init_std_mode(rx_chan, &std_cfg) != ESP_OK) {
+ 193 LOGE(
"i2s_channel_init_std_mode %s",
"rx");
+
+
+ 196 if (i2s_channel_enable(rx_chan) != ESP_OK) {
+ 197 LOGE(
"i2s_channel_enable %s",
"rx");
+
+
+
+
+ 202 LOGD(
"%s - %s", __func__,
"started");
+
+
+
+
+
+
+ 209 i2s_std_slot_config_t result;
+ 210 switch (cfg.i2s_format) {
+ 211 case I2S_LEFT_JUSTIFIED_FORMAT:
+
+ 213 result = I2S_STD_MSB_SLOT_DEFAULT_CONFIG(
+
+
+
+
+ 218 result = I2S_STD_PCM_SLOT_DEFAULT_CONFIG(
+
+
+
+
+ 223 result = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(
+
+
+
+
+
+
+
+ 231 case I2SChannelSelect::Left:
+ 232 result.slot_mask = I2S_STD_SLOT_LEFT;
+
+ 234 case I2SChannelSelect::Right:
+ 235 result.slot_mask = I2S_STD_SLOT_RIGHT;
+
+
+ 238 LOGW(
"Using channel_format: I2SChannelSelect::Left for mono");
+ 239 result.slot_mask = I2S_STD_SLOT_LEFT;
+
+
+
+
+
+
+
+
+
+ 249 i2s_chan_config_t result = I2S_CHANNEL_DEFAULT_CONFIG(
+ 250 (i2s_port_t)cfg.port_no,
+ 251 cfg.is_master ? I2S_ROLE_MASTER : I2S_ROLE_SLAVE);
+
+
+
+ 255 if (size > 0) result.dma_frame_num = size / frame_size;
+ 256 LOGI(
"dma_frame_num: %d", (
int)result.dma_frame_num);
+ 257 result.auto_clear = cfg.auto_clear;
+
+
-
- 262 if (i2s_channel_init_std_mode(rx_chan, &std_cfg) != ESP_OK) {
- 263 LOGE(
"i2s_channel_init_std_mode %s",
"rx");
-
-
- 266 if (i2s_channel_enable(rx_chan) != ESP_OK) {
- 267 LOGE(
"i2s_channel_enable %s",
"rx");
-
-
-
-
- 272 LOGD(
"%s - %s", __func__,
"started");
-
-
-
-
- 277 i2s_chan_handle_t &rx_chan)
override {
-
- 279 auto clock_cfg = getClockConfig(cfg);
- 280 if (tx_chan !=
nullptr) {
- 281 i2s_channel_disable(tx_chan);
- 282 rc = i2s_channel_reconfig_std_clock(tx_chan, &clock_cfg) == ESP_OK;
- 283 i2s_channel_enable(tx_chan);
-
- 285 if (rx_chan !=
nullptr) {
- 286 i2s_channel_disable(rx_chan);
- 287 rc = i2s_channel_reconfig_std_clock(rx_chan, &clock_cfg) == ESP_OK;
- 288 i2s_channel_enable(rx_chan);
-
-
-
-
-
-
-
-
-
-
- 299 return I2S_PDM_TX_SLOT_DEFAULT_CONFIG(
-
-
-
-
-
- 305 return I2S_CHANNEL_DEFAULT_CONFIG(
- 306 (i2s_port_t)cfg.port_no,
- 307 cfg.is_master ? I2S_ROLE_MASTER : I2S_ROLE_SLAVE);
+
+
+ 263 i2s_std_clk_config_t clk_cfg =
+ 264 I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)cfg.
sample_rate);
+
+ 266 clk_cfg.mclk_multiple = (i2s_mclk_multiple_t)cfg.
mclk_multiple;
+
+
+
+ 270 clk_cfg.mclk_multiple = I2S_MCLK_MULTIPLE_384;
+ 271 LOGI(
"mclk_multiple=384");
+
+
+
+
+
+
+ 278 i2s_chan_handle_t &rx_chan)
override {
+
+ 280 auto clock_cfg = getClockConfig(cfg);
+ 281 if (tx_chan !=
nullptr) {
+ 282 i2s_channel_disable(tx_chan);
+ 283 rc = i2s_channel_reconfig_std_clock(tx_chan, &clock_cfg) == ESP_OK;
+ 284 i2s_channel_enable(tx_chan);
+
+ 286 if (rx_chan !=
nullptr) {
+ 287 i2s_channel_disable(rx_chan);
+ 288 rc = i2s_channel_reconfig_std_clock(rx_chan, &clock_cfg) == ESP_OK;
+ 289 i2s_channel_enable(rx_chan);
+
+
+
+
+
+
+
+
+
+
+ 300 i2s_chan_handle_t &rx_chan,
int txPin,
int rxPin) {
+
+ 302 return startTX(cfg, tx_chan, txPin);
+
+ 304 return startRX(cfg, tx_chan, txPin);
+
+ 306 LOGE(
"Only RX and TX is supported for PDM")
+
- 310 i2s_pdm_tx_clk_config_t getTxClockConfig(I2SConfigESP32V1 &cfg) {
- 311 return I2S_PDM_TX_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
-
-
- 314 bool startChannels(I2SConfigESP32V1 &cfg, i2s_chan_handle_t &tx_chan,
- 315 i2s_chan_handle_t &rx_chan,
int txPin,
int rxPin) {
- 316 if (cfg.rx_tx_mode == TX_MODE) {
- 317 i2s_pdm_tx_config_t pdm_tx_cfg = {
- 318 .clk_cfg = getTxClockConfig(cfg),
- 319 .slot_cfg = getTxSlotConfig(cfg),
-
-
- 322 .clk = (gpio_num_t)cfg.pin_bck,
- 323 .dout = (gpio_num_t)txPin,
-
-
-
-
-
-
-
- 331 if (i2s_channel_init_pdm_tx_mode(tx_chan, &pdm_tx_cfg) != ESP_OK) {
- 332 LOGE(
"i2s_channel_init_pdm_tx_mode %s",
"tx");
-
-
- 335 if (i2s_channel_enable(tx_chan) != ESP_OK) {
- 336 LOGE(
"i2s_channel_enable %s",
"tx");
-
-
-
- 340 LOGE(
"Only TX supported for PDM");
-
-
-
-
-
-
-
-
-
-
-
- 352 struct DriverTDM :
public DriverCommon {
- 353 i2s_tdm_slot_config_t getSlotConfig(I2SConfigESP32V1 &cfg) {
-
- 355 for (
int j = 0; j < cfg.channels; j++) {
-
-
-
- 359 i2s_tdm_slot_config_t slot_cfg = I2S_TDM_PHILIPS_SLOT_DEFAULT_CONFIG(
- 360 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
- 361 (i2s_tdm_slot_mask_t)slots);
+
+ 311 i2s_pdm_tx_slot_config_t getTxSlotConfig(I2SConfigESP32V1 &cfg) {
+ 312 return I2S_PDM_TX_SLOT_DEFAULT_CONFIG(
+ 313 (i2s_data_bit_width_t)cfg.bits_per_sample,
+ 314 (i2s_slot_mode_t)cfg.channels);
+
+
+ 317 i2s_pdm_rx_slot_config_t getRxSlotConfig(I2SConfigESP32V1 &cfg) {
+ 318 return I2S_PDM_RX_SLOT_DEFAULT_CONFIG(
+ 319 (i2s_data_bit_width_t)cfg.bits_per_sample,
+ 320 (i2s_slot_mode_t)cfg.channels);
+
+
+ 323 i2s_chan_config_t getChannelConfig(I2SConfigESP32V1 &cfg) {
+ 324 return I2S_CHANNEL_DEFAULT_CONFIG(
+ 325 (i2s_port_t)cfg.port_no,
+ 326 cfg.is_master ? I2S_ROLE_MASTER : I2S_ROLE_SLAVE);
+
+
+ 329 i2s_pdm_tx_clk_config_t getTxClockConfig(I2SConfigESP32V1 &cfg) {
+ 330 return I2S_PDM_TX_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
+
+
+ 333 i2s_pdm_rx_clk_config_t getRxClockConfig(I2SConfigESP32V1 &cfg) {
+ 334 return I2S_PDM_RX_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
+
+
+ 337 bool startTX(I2SConfigESP32V1 &cfg, i2s_chan_handle_t &tx_chan,
int txPin) {
+ 338 i2s_pdm_tx_config_t pdm_tx_cfg = {
+ 339 .clk_cfg = getTxClockConfig(cfg),
+ 340 .slot_cfg = getTxSlotConfig(cfg),
+
+
+ 343 .clk = (gpio_num_t)cfg.pin_bck,
+ 344 .dout = (gpio_num_t)txPin,
+
+
+
+
+
+
+
+ 352 if (i2s_channel_init_pdm_tx_mode(tx_chan, &pdm_tx_cfg) != ESP_OK) {
+ 353 LOGE(
"i2s_channel_init_pdm_tx_mode %s",
"tx");
+
+
+ 356 if (i2s_channel_enable(tx_chan) != ESP_OK) {
+ 357 LOGE(
"i2s_channel_enable %s",
"tx");
+
+
+
+
- 363 switch(cfg.i2s_format){
- 364 case I2S_RIGHT_JUSTIFIED_FORMAT:
-
- 366 case I2S_PHILIPS_FORMAT:
-
- 368 slot_cfg = I2S_TDM_PHILIPS_SLOT_DEFAULT_CONFIG(
- 369 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
- 370 (i2s_tdm_slot_mask_t)slots);
-
- 372 case I2S_LEFT_JUSTIFIED_FORMAT:
-
- 374 slot_cfg = I2S_TDM_MSB_SLOT_DEFAULT_CONFIG(
- 375 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
- 376 (i2s_tdm_slot_mask_t)slots);
-
-
- 379 slot_cfg = I2S_TDM_PCM_LONG_SLOT_DEFAULT_CONFIG(
- 380 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
- 381 (i2s_tdm_slot_mask_t)slots);
-
-
- 384 LOGE(
"TDM: Unsupported format");
+ 363 bool startRX(I2SConfigESP32V1 &cfg, i2s_chan_handle_t &rx_chan,
int rxPin) {
+ 364 i2s_pdm_rx_config_t pdm_rx_cfg = {
+ 365 .clk_cfg = getRxClockConfig(cfg),
+ 366 .slot_cfg = getRxSlotConfig(cfg),
+
+
+ 369 .clk = (gpio_num_t)cfg.pin_bck,
+ 370 .din = (gpio_num_t)rxPin,
+
+
+
+
+
+
+
+ 378 if (i2s_channel_init_pdm_rx_mode(rx_chan, &pdm_rx_cfg) != ESP_OK) {
+ 379 LOGE(
"i2s_channel_init_pdm_rx_mode %s",
"rx");
+
+
+ 382 if (i2s_channel_enable(rx_chan) != ESP_OK) {
+ 383 LOGE(
"i2s_channel_enable %s",
"tx");
+
-
-
-
-
- 390 i2s_chan_config_t getChannelConfig(I2SConfigESP32V1 &cfg) {
- 391 return I2S_CHANNEL_DEFAULT_CONFIG(
- 392 (i2s_port_t)cfg.port_no,
- 393 cfg.is_master ? I2S_ROLE_MASTER : I2S_ROLE_SLAVE);
-
-
- 396 i2s_tdm_clk_config_t getClockConfig(I2SConfigESP32V1 &cfg) {
- 397 return I2S_TDM_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
-
-
- 400 bool startChannels(I2SConfigESP32V1 &cfg, i2s_chan_handle_t &tx_chan,
- 401 i2s_chan_handle_t &rx_chan,
int txPin,
int rxPin) {
- 402 i2s_tdm_config_t tdm_cfg = {
- 403 .clk_cfg = getClockConfig(cfg),
- 404 .slot_cfg = getSlotConfig(cfg),
-
-
- 407 .mclk = (gpio_num_t)cfg.pin_mck,
- 408 .bclk = (gpio_num_t)cfg.pin_bck,
- 409 .ws = (gpio_num_t)cfg.pin_ws,
- 410 .dout = (gpio_num_t)txPin,
- 411 .din = (gpio_num_t)rxPin,
-
-
-
-
-
-
-
-
-
- 421 if (cfg.rx_tx_mode == TX_MODE) {
- 422 if (i2s_channel_init_tdm_mode(tx_chan, &tdm_cfg) != ESP_OK) {
- 423 LOGE(
"i2s_channel_init_tdm_tx_mode %s",
"tx");
-
-
-
- 427 if (cfg.rx_tx_mode == RX_MODE) {
- 428 if (i2s_channel_init_tdm_mode(rx_chan, &tdm_cfg) != ESP_OK) {
- 429 LOGE(
"i2s_channel_init_tdm_tx_mode %s",
"rx");
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 448 LOGE(
"invalid channels: %d", cfg.
channels);
-
-
-
-
- 453 if (!newChannels(cfg, driver)) {
-
-
-
-
- 458 is_started = driver.startChannels(cfg, tx_chan, rx_chan, txPin, rxPin);
-
-
- 461 LOGE(
"Channels not started");
-
-
-
-
-
- 467 i2s_chan_config_t chan_cfg = driver.getChannelConfig(cfg);
-
-
- 470 if (i2s_new_channel(&chan_cfg, NULL, &rx_chan) != ESP_OK) {
-
-
-
-
-
- 476 if (i2s_new_channel(&chan_cfg, &tx_chan, NULL) != ESP_OK) {
-
-
-
-
-
- 482 if (i2s_new_channel(&chan_cfg, &tx_chan, &rx_chan) != ESP_OK) {
-
-
-
-
-
-
-
- 490 DriverCommon &getDriver(I2SConfigESP32V1 &cfg) {
- 491 switch (cfg.signal_type) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 506 LOGE(
"Unsupported singal_type");
-
-
-
-
- 511 using I2SDriver = I2SDriverESP32V1;
+
+
+
+
+
+
+
+
+
+
+ 396 struct DriverTDM :
public DriverCommon {
+ 397 bool startChannels(I2SConfigESP32V1 &cfg, i2s_chan_handle_t &tx_chan,
+ 398 i2s_chan_handle_t &rx_chan,
int txPin,
int rxPin) {
+ 399 i2s_tdm_config_t tdm_cfg = {
+ 400 .clk_cfg = getClockConfig(cfg),
+ 401 .slot_cfg = getSlotConfig(cfg),
+
+
+ 404 .mclk = (gpio_num_t)cfg.pin_mck,
+ 405 .bclk = (gpio_num_t)cfg.pin_bck,
+ 406 .ws = (gpio_num_t)cfg.pin_ws,
+ 407 .dout = (gpio_num_t)txPin,
+ 408 .din = (gpio_num_t)rxPin,
+
+
+
+
+
+
+
+
+
+ 418 if (cfg.rx_tx_mode == TX_MODE) {
+ 419 if (i2s_channel_init_tdm_mode(tx_chan, &tdm_cfg) != ESP_OK) {
+ 420 LOGE(
"i2s_channel_init_tdm_tx_mode %s",
"tx");
+
+
+
+ 424 if (cfg.rx_tx_mode == RX_MODE) {
+ 425 if (i2s_channel_init_tdm_mode(rx_chan, &tdm_cfg) != ESP_OK) {
+ 426 LOGE(
"i2s_channel_init_tdm_tx_mode %s",
"rx");
+
+
+
+
+ 431 LOGE(
"Only RX and TX is supported for TDM")
+
+
+
+
+ 436 i2s_tdm_slot_config_t getSlotConfig(I2SConfigESP32V1 &cfg) {
+
+ 438 for (
int j = 0; j < cfg.channels; j++) {
+
+
+
+ 442 i2s_tdm_slot_config_t slot_cfg = I2S_TDM_PHILIPS_SLOT_DEFAULT_CONFIG(
+ 443 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
+ 444 (i2s_tdm_slot_mask_t)slots);
+
+ 446 switch (cfg.i2s_format) {
+ 447 case I2S_RIGHT_JUSTIFIED_FORMAT:
+
+ 449 case I2S_PHILIPS_FORMAT:
+
+ 451 slot_cfg = I2S_TDM_PHILIPS_SLOT_DEFAULT_CONFIG(
+ 452 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
+ 453 (i2s_tdm_slot_mask_t)slots);
+
+ 455 case I2S_LEFT_JUSTIFIED_FORMAT:
+
+ 457 slot_cfg = I2S_TDM_MSB_SLOT_DEFAULT_CONFIG(
+ 458 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
+ 459 (i2s_tdm_slot_mask_t)slots);
+
+
+ 462 slot_cfg = I2S_TDM_PCM_LONG_SLOT_DEFAULT_CONFIG(
+ 463 (i2s_data_bit_width_t)cfg.bits_per_sample, I2S_SLOT_MODE_STEREO,
+ 464 (i2s_tdm_slot_mask_t)slots);
+
+
+ 467 LOGE(
"TDM: Unsupported format");
+
+
+
+
+
+ 473 i2s_chan_config_t getChannelConfig(I2SConfigESP32V1 &cfg) {
+ 474 return I2S_CHANNEL_DEFAULT_CONFIG(
+ 475 (i2s_port_t)cfg.port_no,
+ 476 cfg.is_master ? I2S_ROLE_MASTER : I2S_ROLE_SLAVE);
+
+
+ 479 i2s_tdm_clk_config_t getClockConfig(I2SConfigESP32V1 &cfg) {
+ 480 return I2S_TDM_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
+
+
+
+
+
+
+
+
+
+
+
+
+ 495 LOGE(
"invalid channels: %d", cfg.
channels);
+
+
+
+
+ 500 if (!newChannels(cfg, driver)) {
+
+
+
+
+ 505 is_started = driver.startChannels(cfg, tx_chan, rx_chan, txPin, rxPin);
+
+
+ 508 LOGE(
"Channels not started");
+
+
+
-
-
-
+
+ 514 i2s_chan_config_t chan_cfg = driver.getChannelConfig(cfg);
+
+
+ 517 if (i2s_new_channel(&chan_cfg, NULL, &rx_chan) != ESP_OK) {
+
+
+
+
+
+ 523 if (i2s_new_channel(&chan_cfg, &tx_chan, NULL) != ESP_OK) {
+
+
+
+
+
+ 529 if (i2s_new_channel(&chan_cfg, &tx_chan, &rx_chan) != ESP_OK) {
+
+
+
+
+
+
+
+ 537 DriverCommon &getDriver(I2SConfigESP32V1 &cfg) {
+ 538 switch (cfg.signal_type) {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 553 LOGE(
"Unsupported singal_type");
+
+
+
+
+ 558 using I2SDriver = I2SDriverESP32V1;
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
RxTxMode
The Microcontroller is the Audio Source (TX_MODE) or Audio Sink (RX_MODE). RXTX_MODE is Source and Si...
Definition: AudioTypes.h:26
@@ -590,7 +637,7 @@
-
+
diff --git a/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s-members.html b/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s-members.html
index 6e89eba91..99d8a4b29 100644
--- a/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s-members.html
+++ b/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s-members.html
@@ -72,10 +72,10 @@
This is the complete list of members for I2SDriverESP32V1::DriverI2S, including all inherited members.
diff --git a/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s.html b/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s.html
index acb0a5d36..d38ea7a1c 100644
--- a/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s.html
+++ b/structaudio__tools_1_1_i2_s_driver_e_s_p32_v1_1_1_driver_i2_s.html
@@ -67,6 +67,7 @@