From b64f4f9e44613e58433b88c633a01d94df14307e Mon Sep 17 00:00:00 2001 From: robert-hh Date: Tue, 5 Aug 2025 10:12:16 +0200 Subject: [PATCH] tests/extmod_hardware/machine_encoder.py: Add a MIMXRT configuration. For Teensy 4.x. The connectivity tests and the falling edge of the counter test are skipped. Signed-off-by: robert-hh --- tests/extmod_hardware/machine_counter.py | 7 +++++++ tests/target_wiring/mimxrt.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/tests/extmod_hardware/machine_counter.py b/tests/extmod_hardware/machine_counter.py index 62ac1fed47..22acef07c0 100644 --- a/tests/extmod_hardware/machine_counter.py +++ b/tests/extmod_hardware/machine_counter.py @@ -16,6 +16,11 @@ if "esp32" in sys.platform: id = 0 out_pin = 4 in_pin = 5 +elif sys.platform == "mimxrt": + if "Teensy" in sys.implementation._machine: + id = 0 + out_pin = "D2" + in_pin = "D3" else: print("Please add support for this test on this platform.") raise SystemExit @@ -43,6 +48,7 @@ class TestCounter(unittest.TestCase): def assertCounter(self, value): self.assertEqual(self.counter.value(), value) + @unittest.skipIf(sys.platform == "mimxrt", "cannot read back the pin") def test_connections(self): # Test the hardware connections are correct. If this test fails, all tests will fail. out_pin(1) @@ -73,6 +79,7 @@ class TestCounter(unittest.TestCase): toggle(25) self.assertCounter(75) + @unittest.skipIf(sys.platform == "mimxrt", "FALLING edge not supported") def test_count_falling(self): self.counter.init(in_pin, direction=Counter.UP, edge=Counter.FALLING) toggle(20) diff --git a/tests/target_wiring/mimxrt.py b/tests/target_wiring/mimxrt.py index 8d2c0b15c2..e1e51ea143 100644 --- a/tests/target_wiring/mimxrt.py +++ b/tests/target_wiring/mimxrt.py @@ -7,3 +7,7 @@ uart_loopback_args = (1,) uart_loopback_kwargs = {} spi_standalone_args_list = [()] + +encoder_loopback_id = 0 +encoder_loopback_out_pins = ("D0", "D2") +encoder_loopback_in_pins = ("D1", "D3")