Skip to content

Commit

Permalink
tests/extmod: Update I2S rate test to work on mimxrt.
Browse files Browse the repository at this point in the history
Tested on Teensy 4.0.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Mar 30, 2022
1 parent 1f6cb8f commit 3e70be8
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tests/extmod/machine_i2s_rate.py
Expand Up @@ -13,18 +13,24 @@
i2s_id = 2
sck_pin = Pin("Y6")
ws_pin = Pin("Y5")
sd_pin = Pin("Y8")
sd_tx_pin = sd_rx_pin = Pin("Y8")
elif "rp2" in sys.platform:
i2s_id = 1
sck_pin = Pin(0)
ws_pin = Pin(1)
sd_pin = Pin(2)
sd_tx_pin = sd_rx_pin = Pin(2)
elif "mimxrt" in sys.platform:
i2s_id = 1
sck_pin = Pin(26)
ws_pin = Pin(27)
sd_tx_pin = Pin(7)
sd_rx_pin = Pin(8)

TEST_BYTES = b"01234567"
RATE = 11025 # frames/sec


def test(mode, bits_per_sample, frame_format):
def test(mode, sd_pin, bits_per_sample, frame_format):
i2s = I2S(
i2s_id,
sck=sck_pin,
Expand Down Expand Up @@ -70,11 +76,11 @@ def test(mode, bits_per_sample, frame_format):
print(mode_str, bits_per_sample, channels, abs(dt - 500) <= 4)


test(I2S.TX, 16, I2S.MONO)
test(I2S.TX, 16, I2S.STEREO)
test(I2S.TX, 32, I2S.MONO)
test(I2S.TX, 32, I2S.STEREO)
test(I2S.RX, 16, I2S.MONO)
test(I2S.RX, 16, I2S.STEREO)
test(I2S.RX, 32, I2S.MONO)
test(I2S.RX, 32, I2S.STEREO)
test(I2S.TX, sd_tx_pin, 16, I2S.MONO)
test(I2S.TX, sd_tx_pin, 16, I2S.STEREO)
test(I2S.TX, sd_tx_pin, 32, I2S.MONO)
test(I2S.TX, sd_tx_pin, 32, I2S.STEREO)
test(I2S.RX, sd_rx_pin, 16, I2S.MONO)
test(I2S.RX, sd_rx_pin, 16, I2S.STEREO)
test(I2S.RX, sd_rx_pin, 32, I2S.MONO)
test(I2S.RX, sd_rx_pin, 32, I2S.STEREO)

0 comments on commit 3e70be8

Please sign in to comment.