From ae0a65b1785b0ced5bffba7cae999e17e42b4513 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Wed, 18 Oct 2023 16:19:57 +0200 Subject: [PATCH] tests/psoc6/dut: Added pin test requiring hw dut connections. Signed-off-by: enriquezgarc --- tests/psoc6/dut/i2c_master_slave.py | 0 tests/psoc6/dut/pin.py | 43 +++++++++++++++++++++++++++++ tests/psoc6/dut/pin.py.exp | 8 ++++++ 3 files changed, 51 insertions(+) delete mode 100644 tests/psoc6/dut/i2c_master_slave.py create mode 100644 tests/psoc6/dut/pin.py create mode 100644 tests/psoc6/dut/pin.py.exp diff --git a/tests/psoc6/dut/i2c_master_slave.py b/tests/psoc6/dut/i2c_master_slave.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/psoc6/dut/pin.py b/tests/psoc6/dut/pin.py new file mode 100644 index 000000000000..298fb4406d65 --- /dev/null +++ b/tests/psoc6/dut/pin.py @@ -0,0 +1,43 @@ +import os +from machine import Pin +import machine + +# Allocate pin based on board +machine = os.uname().machine +if "CY8CPROTO-062-4343W" in machine: + pin1_name = "P13_7" + pin2_name = "P13_6" +elif "CY8CPROTO-063-BLE" in machine: + pin1_name = "P6_3" + pin2_name = "P6_2" + +# Pin out and pin in must be connected +# together in the board + +pin_out = Pin(pin1_name) +pin_out.init(Pin.OUT) +pin_in = Pin(pin2_name, Pin.IN) + +pin_out.value(1) +print("pin out value 1: ", pin_in.value() == 1) + +pin_out.value(0) +print("pin out value 0: ", pin_in.value() == 0) + +pin_out.value(True) +print("pin out value True: ", pin_in.value() == True) + +pin_out.value(False) +print("pin out value False: ", pin_in.value() == False) + +pin_out.high() +print("pin out value high: ", pin_in.value() == 1) + +pin_out.low() +print("pin out value low: ", pin_in.value() == 0) + +pin_out.on() +print("pin out value on: ", pin_in.value() == 1) + +pin_out.off() +print("pin out value off: ", pin_in.value() == 0) diff --git a/tests/psoc6/dut/pin.py.exp b/tests/psoc6/dut/pin.py.exp new file mode 100644 index 000000000000..98817fc78542 --- /dev/null +++ b/tests/psoc6/dut/pin.py.exp @@ -0,0 +1,8 @@ +pin out value 1: True +pin out value 0: True +pin out value True: True +pin out value False: True +pin out value high: True +pin out value low: True +pin out value on: True +pin out value off: True