Skip to content

Commit

Permalink
esp32/machine_i2s: Fix deprecated fields and constants.
Browse files Browse the repository at this point in the history
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
  • Loading branch information
IhorNehrutsa authored and dpgeorge committed Dec 11, 2023
1 parent a427117 commit 3069fee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ports/esp32/machine_i2s.c
Expand Up @@ -354,22 +354,22 @@ STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *ar
self->io_mode = BLOCKING;

i2s_config_t i2s_config;
i2s_config.communication_format = I2S_COMM_FORMAT_I2S;
i2s_config.communication_format = I2S_COMM_FORMAT_STAND_I2S;
i2s_config.mode = mode;
i2s_config.bits_per_sample = get_dma_bits(mode, bits);
i2s_config.channel_format = get_dma_format(mode, format);
i2s_config.sample_rate = self->rate;
i2s_config.intr_alloc_flags = ESP_INTR_FLAG_LOWMED;
i2s_config.dma_buf_count = get_dma_buf_count(mode, bits, format, self->ibuf);
i2s_config.dma_buf_len = DMA_BUF_LEN_IN_I2S_FRAMES;
i2s_config.dma_desc_num = get_dma_buf_count(mode, bits, format, self->ibuf);
i2s_config.dma_frame_num = DMA_BUF_LEN_IN_I2S_FRAMES;
i2s_config.use_apll = false;
i2s_config.tx_desc_auto_clear = true;
i2s_config.fixed_mclk = 0;
i2s_config.mclk_multiple = I2S_MCLK_MULTIPLE_256;
i2s_config.bits_per_chan = 0;

// I2S queue size equals the number of DMA buffers
check_esp_err(i2s_driver_install(self->i2s_id, &i2s_config, i2s_config.dma_buf_count, &self->i2s_event_queue));
check_esp_err(i2s_driver_install(self->i2s_id, &i2s_config, i2s_config.dma_desc_num, &self->i2s_event_queue));

// apply low-level workaround for bug in some ESP-IDF versions that swap
// the left and right channels
Expand Down
2 changes: 1 addition & 1 deletion ports/esp32/mpconfigport.h
Expand Up @@ -126,7 +126,7 @@
#define MICROPY_PY_MACHINE_DAC (SOC_DAC_SUPPORTED)
#endif
#ifndef MICROPY_PY_MACHINE_I2S
#define MICROPY_PY_MACHINE_I2S (1)
#define MICROPY_PY_MACHINE_I2S (SOC_I2S_SUPPORTED)
#endif
#define MICROPY_PY_MACHINE_I2S_INCLUDEFILE "ports/esp32/machine_i2s.c"
#define MICROPY_PY_MACHINE_I2S_FINALISER (1)
Expand Down

0 comments on commit 3069fee

Please sign in to comment.