Skip to content

Commit 0944376

Browse files
IhorNehrutsadpgeorge
authored andcommitted
tests/extmod_hardware/machine_encoder.py: Use target_wiring for encoder.
Signed-off-by: Ihor Nehrutsa <[email protected]>
1 parent d980bbd commit 0944376

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

tests/extmod_hardware/machine_encoder.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,16 @@
1111
raise SystemExit
1212

1313
import sys
14+
import unittest
1415
from machine import Pin
16+
from target_wiring import encoder_loopback_id, encoder_loopback_out_pins, encoder_loopback_in_pins
1517

1618
PRINT = False
1719
PIN_INIT_VALUE = 1
1820

19-
if "esp32" in sys.platform:
20-
id = 0
21-
out0_pin = 4
22-
in0_pin = 5
23-
out1_pin = 12
24-
in1_pin = 13
25-
else:
26-
print("Please add support for this test on this platform.")
27-
raise SystemExit
28-
29-
import unittest
21+
id = encoder_loopback_id
22+
out0_pin, out1_pin = encoder_loopback_out_pins
23+
in0_pin, in1_pin = encoder_loopback_in_pins
3024

3125
out0_pin = Pin(out0_pin, mode=Pin.OUT)
3226
in0_pin = Pin(in0_pin, mode=Pin.IN)

tests/run-tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ def open(self, path, mode):
309309
tests_requiring_target_wiring = (
310310
"extmod/machine_uart_irq_txidle.py",
311311
"extmod/machine_uart_tx.py",
312+
"extmod_hardware/machine_encoder.py",
312313
"extmod_hardware/machine_uart_irq_break.py",
313314
"extmod_hardware/machine_uart_irq_rx.py",
314315
"extmod_hardware/machine_uart_irq_rxidle.py",

tests/target_wiring/esp32.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
#
33
# Connect:
44
# - GPIO4 to GPIO5
5+
# - GPIO12 to GPIO13
56

67
uart_loopback_args = (1,)
78
uart_loopback_kwargs = {"tx": 4, "rx": 5}
9+
10+
encoder_loopback_id = 0
11+
encoder_loopback_out_pins = (4, 12)
12+
encoder_loopback_in_pins = (5, 13)

0 commit comments

Comments
 (0)