mirror of
https://github.com/micropython/micropython.git
synced 2026-03-11 19:30:28 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user