8000 tests/extmod/machine_uart_irq_txidle.py: Simplify the test script. · cuatrobits/micropython@e23fdb1 · GitHub
[go: up one dir, main page]

Skip to content

Commit e23fdb1

Browse files
robert-hhdpgeorge
authored andcommitted
tests/extmod/machine_uart_irq_txidle.py: Simplify the test script.
Now that no minimal delay time is required for SAMD devices. Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent 1a6279b commit e23fdb1

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

tests/extmod/machine_uart_irq_txidle.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,20 @@
1616
uart_id = 0
1717
tx_pin = "GPIO0"
1818
rx_pin = "GPIO1"
19-
min_window = 1
2019
elif "samd" in sys.platform and "ItsyBitsy M0" in sys.implementation._machine:
2120
uart_id = 0
2221
tx_pin = "D1"
2322
rx_pin = "D0"
24-
# For SAMD delay_ms has to be used for the trailing window, and the
25-
# mininmal time is 11 ms to allow for scheduling.
26-
min_window = 11
2723
elif "samd" in sys.platform and "ItsyBitsy M4" in sys.implementation._machine:
2824
uart_id = 3
2925
tx_pin = "D1"
3026
rx_pin = "D0"
31-
min_window = 11
3227
elif "mimxrt" in sys.platform:
3328
uart_id = 1
3429
tx_pin = None
35-
min_window = 0
3630
elif "nrf" in sys.platform:
3731
uart_id = 0
3832
tx_pin = None
39-
min_window = 0
4033
else:
4134
print("Please add support for this test on this platform.")
4235
raise SystemExit
@@ -61,12 +54,11 @@ def irq(u):
6154
# the test marks a time window close to the expected of the sending
6255
# and the time at which the IRQ should have been fired.
6356
# It is just a rough estimation of 10 characters before and
64-
# 20 characters after the data's end, unless there is a need to
65-
# wait a minimal time, like for SAMD devices.
57+
# 20 characters after the data's end.
6658

6759
bits_per_char = 10 # 1(startbit) + 8(bits) + 1(stopbit) + 0(parity)
6860
start_time_us = (len(text) - 10) * bits_per_char * 1_000_000 // bits_per_s
69-
window_ms = max(min_window, 20 * bits_per_char * 1_000 // bits_per_s + 1)
61+
window_ms = 20 * bits_per_char * 1_000 // bits_per_s + 1
7062

7163
print("write", bits_per_s)
7264
uart.write(text)

0 commit comments

Comments
 (0)
0