mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 19:50:30 +01:00
mixmrt/machine_i2s: Add I2S protocol support.
This commit adds support for machine.I2S on the mimxrt port. The I2S API is consistent with the existing stm32, esp32, and rp2 implementations. I2S features: - controller transmit and controller receive - 16-bit and 32-bit sample sizes - mono and stereo formats - sampling frequencies from 8kHz to 48kHz - 3 modes of operation: - blocking - non-blocking with callback - uasyncio - configurable internal buffer - optional MCK Tested with the following development boards: - MIMXRT1010_EVK, MIMXRT1015_EVK, MIMXRT1020_EVK, MIMXRT1050_EVK - Teensy 4.0, Teensy 4.1 - Olimex RT1010 - Seeed ARCH MIX Tested with the following I2S hardware peripherals: - UDA1334 - GY-SPH0645LM4H - WM8960 codec on board the MIMXRT boards and separate breakout board - INMP441 - PCM5102 - SGTL5000 on the Teensy audio shield Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
This commit is contained in:
committed by
Damien George
parent
5e685a9c6f
commit
1f6cb8f047
@@ -30,7 +30,7 @@
|
||||
#include "py/mperrno.h"
|
||||
#include "extmod/machine_spi.h"
|
||||
#include "modmachine.h"
|
||||
#include "dma_channel.h"
|
||||
#include "dma_manager.h"
|
||||
|
||||
#include "fsl_cache.h"
|
||||
#include "fsl_dmamux.h"
|
||||
@@ -256,8 +256,6 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8
|
||||
bool use_dma = chan_rx >= 0 && chan_tx >= 0;
|
||||
|
||||
if (use_dma) {
|
||||
edma_config_t userConfig;
|
||||
|
||||
/* DMA MUX init*/
|
||||
DMAMUX_Init(DMAMUX);
|
||||
|
||||
@@ -267,8 +265,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8
|
||||
DMAMUX_SetSource(DMAMUX, chan_tx, dma_req_src_tx[self->spi_hw_id]);
|
||||
DMAMUX_EnableChannel(DMAMUX, chan_tx);
|
||||
|
||||
EDMA_GetDefaultConfig(&userConfig);
|
||||
EDMA_Init(DMA0, &userConfig);
|
||||
dma_init();
|
||||
|
||||
lpspi_master_edma_handle_t g_master_edma_handle;
|
||||
edma_handle_t lpspiEdmaMasterRxRegToRxDataHandle;
|
||||
|
||||
Reference in New Issue
Block a user