circuitpython/ports/mimxrt10xx/common-hal
Jeff Epler c6bc9c48c9
mimxrt10xx: implement i2sout
tested on metro m7 (green prototype version) with max98357a i2s amplifier and the following test code:
```py
import board
import time
import digitalio
from audiobusio import I2SOut
from audiocore import RawSample
from microcontroller import pin
from ulab import numpy as np

n = np.array(np.sin(np.linspace(0, np.pi*2, 218, endpoint=False)) * 200, dtype=np.int16)
print(n)
r = RawSample(n, sample_rate=8000, channel_count=2)
def main():
    with digitalio.DigitalInOut(board.LED) as l:
        l.switch_to_output(True)
        value = False
        while True:
            with I2SOut(pin.GPIO_06, pin.GPIO_07, pin.GPIO_04) as i:
                time.sleep(.01)
                l.value = value = not value
                i.play(r, loop=True)
                print(i.playing)
                time.sleep(.5)
                i.stop()
                print("STOPPED")
                print(i.playing)
                time.sleep(.5)
                i.play(r, loop=True)
                print(i.playing)
                print("PLAY AGAIN")
                time.sleep(.5)
            time.sleep(1)
```

Only stereo, 16-bit, raw samples were tested; the sample rate is actually fixed
at 48kHz in the core right now. There is more to do, but the basics work.

# Conflicts:
#	ports/mimxrt10xx/Makefile
#	ports/mimxrt10xx/mpconfigport.mk
2023-03-22 12:15:25 -05:00
..
analogio Switch iMX RT sdk to NXP repo 2023-03-21 16:21:57 -07:00
audiobusio mimxrt10xx: implement i2sout 2023-03-22 12:15:25 -05:00
board Add license to some obvious files. 2020-07-06 19:16:25 +01:00
busio Switch iMX RT sdk to NXP repo 2023-03-21 16:21:57 -07:00
digitalio Switch iMX RT sdk to NXP repo 2023-03-21 16:21:57 -07:00
microcontroller mimxrt10xx: implement i2sout 2023-03-22 12:15:25 -05:00
neopixel_write Improve iMX RT performance 2023-03-14 12:30:58 -07:00
os Switch iMX RT sdk to NXP repo 2023-03-21 16:21:57 -07:00
pwmio Switch iMX RT sdk to NXP repo 2023-03-21 16:21:57 -07:00
rtc Switch iMX RT sdk to NXP repo 2023-03-21 16:21:57 -07:00
supervisor run code formatting script 2021-03-15 19:27:36 +05:30
usb_host message consolidation and more use of validators 2022-05-19 15:38:37 -04:00