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 <robert@hammelrath.com>
This commit is contained in:
robert-hh
2025-08-05 10:12:16 +02:00
committed by Damien George
parent 655dc9fcea
commit b64f4f9e44
2 changed files with 11 additions and 0 deletions

View File

@@ -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)

View File

@@ -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")