Skip to content

esp32: Allow I2S pins to be None - #19716

Open
jonathanhogg wants to merge 1 commit into
micropython:masterfrom
jonathanhogg:esp32_i2s_pins
Open

jonathanhogg wants to merge 1 commit into
micropython:masterfrom
jonathanhogg:esp32_i2s_pins

Conversation

@jonathanhogg

@jonathanhogg jonathanhogg commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

This allows disabling specific signals of the I2S peripheral, which is useful if you are abusing it for other purposes. Also add the mck pin argument on esp32 since the peripheral supports that signal.

Note that the MP_OBJ_NULL check is changed to mp_const_none. The NULL check was always unnecessary as the arguments were marked as required. The, now enabled, mck argument is not marked as required but has None as its default anyway.

Generally, you'd only want to set the pins to None if you're misusing the I2S peripheral. In my case, I'm using it to generate a WS2812 bitstream. One can also do this with an SPI peripheral, which already supports disabling the unused signal and was the inspiration for this patch. The advantage of using the I2S peripheral is that it supports asynchronous usage and cleanly chains DMA buffers for uninterrupted output.

Testing

I've tested this on a UM_TINY_S3 device.

Trade-offs and Alternatives

It's a pretty minor patch, all things considered.

Generative AI

I did not use generative AI tools when creating this PR.

This allows disabling specific signals of the I2S peripheral, which is 
useful if you are abusing it for other purposes. Also add the `mck` 
pin argument on esp32 since the peripheral support that signal.
@github-actions

Copy link
Copy Markdown

Code size report:

Reference:  esp32/boards/SEEED_XIAO_ESP32C5: Use 0x2000 as the flash offset. [b0310f5]
Comparison: esp32: Allow I2S pins to be None. [merge of 9998806]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:   +64 +0.004% ESP32_GENERIC[incl +32(data)]
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants