forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/psoc6/dut: Added pin test requiring hw dut connections.
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
- Loading branch information
1 parent
68e3aa9
commit ae0a65b
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |