Skip to content

Commit

Permalink
tests/psoc6/dut: Added pin test requiring hw dut connections.
Browse files Browse the repository at this point in the history
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
  • Loading branch information
jaenrig-ifx committed Oct 18, 2023
1 parent 68e3aa9 commit ae0a65b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
Empty file.
43 changes: 43 additions & 0 deletions tests/psoc6/dut/pin.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions tests/psoc6/dut/pin.py.exp
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ae0a65b

Please sign in to comment.