8000 esp32/machine_i2s: Integrate new I2S IDF driver. by miketeachman · Pull Request #13727 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

esp32/machine_i2s: Integrate new I2S IDF driver. #13727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions extmod/machine_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ static mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in,
#else
uint32_t num_bytes_written = copy_appbuf_to_dma(self, &appbuf);
#endif

return num_bytes_written;
}
}
Expand All @@ -632,16 +633,8 @@ static mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
ret |= MP_STREAM_ FC18 POLL_RD;
}
#else
// check event queue to determine if a DMA buffer has been filled
// (which is an indication that at least one DMA buffer is available to be read)
// note: timeout = 0 so the call is non-blocking
i2s_event_t i2s_event;
if (xQueueReceive(self->i2s_event_queue, &i2s_event, 0)) {
if (i2s_event.type == I2S_EVENT_RX_DONE) {
// getting here means that at least one DMA buffer is now full
// indicating that audio samples can be read from the I2S object
ret |= MP_STREAM_POLL_RD;
}
if (self->dma_buffer_status == DMA_MEMORY_NOT_EMPTY) {
ret |= MP_STREAM_POLL_RD;
}
#endif
}
Expand All @@ -657,16 +650,8 @@ static mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
ret |= MP_STREAM_POLL_WR;
}
#else
// check event queue to determine if a DMA buffer has been emptied
// (which is an indication that at least one DMA buffer is available to be written)
// note: timeout = 0 so the call is non-blocking
i2s_event_t i2s_event;
if (xQueueReceive(self->i2s_event_queue, &i2s_event, 0)) {
if (i2s_event.type == I2S_EVENT_TX_DONE) {
// getting here means that at least one DMA buffer is now empty
// indicating that audio samples can be written to the I2S object
ret |= MP_STREAM_POLL_WR;
}
if (self->dma_buffer_status == DMA_MEMORY_NOT_FULL) {
ret |= MP_STREAM_POLL_WR;
}
#endif
}
Expand Down
1 change: 0 additions & 1 deletion ports/esp32/boards/sdkconfig.base
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ CONFIG_UART_ISR_IN_IRAM=y
# IDF 5 deprecated
CONFIG_ADC_SUPPRESS_DEPRECATE_WARN=y
CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y
CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y

CONFIG_ETH_USE_SPI_ETHERNET=y
CONFIG_ETH_SPI_ETHERNET_W5500=y
Expand Down
Loading
0