summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-01-30 12:44:25 +1100
committerDamien George <damien@micropython.org>2024-01-30 12:50:19 +1100
commit2d7fb9a715d8c9f1f7ba73a62cfd587fa6ffc24a (patch)
tree1e4727f4da142941bfbe6f0b7c8296262cc304a4 /tests
parent807c25d05a81feed1dd0cbc5fde5e0d1ef45c967 (diff)
downloadmicropython-2d7fb9a715d8c9f1f7ba73a62cfd587fa6ffc24a.tar.gz
micropython-2d7fb9a715d8c9f1f7ba73a62cfd587fa6ffc24a.zip
tests/ports/rp2/rp2_dma.py: Tweak test to be more reliable.
The timing of the DMA transfer can vary a bit, so tweak the allowed values. Also test the return value of `rp2.DMA.irq.flags()` to make sure the IRQ is correctly signalled. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ports/rp2/rp2_dma.py4
-rw-r--r--tests/ports/rp2/rp2_dma.py.exp2
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/ports/rp2/rp2_dma.py b/tests/ports/rp2/rp2_dma.py
index cd97f0357b..2459213f4c 100644
--- a/tests/ports/rp2/rp2_dma.py
+++ b/tests/ports/rp2/rp2_dma.py
@@ -62,7 +62,7 @@ dma.write = dest
dma.count = len(dest) // 4
dma.ctrl = dma.pack_ctrl()
dt = run_and_time_dma(dma)
-print(60 <= dt <= 90)
+print(70 <= dt <= 110)
print(dest[:8], dest[-8:])
dma.close()
@@ -80,7 +80,7 @@ dma.close()
print("# test irq")
dest = bytearray(1024)
dma = rp2.DMA()
-dma.irq(lambda _: print("irq fired"))
+dma.irq(lambda dma: print("irq fired", dma.irq().flags()))
dma.config(
read=src, write=dest, count=len(dest) // 4, ctrl=dma.pack_ctrl(irq_quiet=0), trigger=True
)
diff --git a/tests/ports/rp2/rp2_dma.py.exp b/tests/ports/rp2/rp2_dma.py.exp
index 956aee4e34..79f17626ac 100644
--- a/tests/ports/rp2/rp2_dma.py.exp
+++ b/tests/ports/rp2/rp2_dma.py.exp
@@ -12,5 +12,5 @@ bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\
# test immediate trigger
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
# test irq
-irq fired
+irq fired 1
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07') bytearray(b'\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')