diff options
author | Mike Teachman <mike.teachman@gmail.com> | 2021-09-03 20:34:53 -0700 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-11-13 12:27:42 +1100 |
commit | b6dbbbe82f7114cb5b56c54e916e304f416cd47a (patch) | |
tree | 9616b8a01da138e291b09a24c0f2e111761a996c /docs/rp2 | |
parent | 6d5296e65e8eb2330dbddd21b167088abf93f57a (diff) | |
download | micropython-b6dbbbe82f7114cb5b56c54e916e304f416cd47a.tar.gz micropython-b6dbbbe82f7114cb5b56c54e916e304f416cd47a.zip |
rp2/machine_i2s: Add I2S protocol support.
This commit adds I2S protocol support for the rp2 port:
- I2S API is consistent with STM32 and ESP32 ports
- I2S configurations supported:
- master transmit and master receive
- 16-bit and 32-bit sample sizes
- mono and stereo formats
- sampling frequency
- 3 modes of operation:
- blocking
- non-blocking with callback
- uasyncio
- internal ring buffer size can be tuned
- DMA IRQs are managed on an I2S object basis, allowing other
RP2 entities to use DMA IRQs when I2S is not being used
- MicroPython documentation
- tested on Raspberry Pi Pico development board
- build metric changes for this commit: text(+4552), data(0), bss(+8)
Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
Diffstat (limited to 'docs/rp2')
-rw-r--r-- | docs/rp2/quickref.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/rp2/quickref.rst b/docs/rp2/quickref.rst index ac9cdb86cb..63b8928280 100644 --- a/docs/rp2/quickref.rst +++ b/docs/rp2/quickref.rst @@ -219,6 +219,26 @@ has the same methods as software I2C above:: i2c = I2C(0) # default assignment: scl=Pin(9), sda=Pin(8) i2c = I2C(1, scl=Pin(3), sda=Pin(2), freq=400_000) +I2S bus +------- + +See :ref:`machine.I2S <machine.I2S>`. :: + + from machine import I2S, Pin + + i2s = I2S(0, sck=Pin(16), ws=Pin(17), sd=Pin(18), mode=I2S.TX, bits=16, format=I2S.STEREO, rate=44100, ibuf=40000) # create I2S object + i2s.write(buf) # write buffer of audio samples to I2S device + + i2s = I2S(1, sck=Pin(0), ws=Pin(1), sd=Pin(2), mode=I2S.RX, bits=16, format=I2S.MONO, rate=22050, ibuf=40000) # create I2S object + i2s.readinto(buf) # fill buffer with audio samples from I2S device + +The ``ws`` pin number must be one greater than the ``sck`` pin number. + +The I2S class is currently available as a Technical Preview. During the preview period, feedback from +users is encouraged. Based on this feedback, the I2S class API and implementation may be changed. + +Two I2S buses are supported with id=0 and id=1. + Real time clock (RTC) --------------------- |