Skip to content

Commit

Permalink
tests/renesas-ra: Update pin test to support all boards.
Browse files Browse the repository at this point in the history
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
  • Loading branch information
TakeoTakahashi2020 authored and dpgeorge committed Aug 31, 2022
1 parent 621bff8 commit 2f2fd36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 47 deletions.
46 changes: 9 additions & 37 deletions tests/renesas-ra/pin.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,15 @@
from machine import Pin
import os

n = os.uname().machine
if "RA4W1_EK" in n:
try_pin = "P004"
try_s = "Pin(Pin.cpu.P004, mode=Pin.IN, pull=Pin.PULL_NONE, drive=Pin.LOW_POWER)"
p = Pin("SW1", Pin.IN)
if p.value() == 1:
print("pass")
else:
try_pin = "P000"
try_s = "Pin(Pin.cpu.P000, mode=Pin.IN, pull=Pin.PULL_NONE, drive=Pin.LOW_POWER)"
print("FAIL")

p = Pin(try_pin, Pin.IN)
if str(p) == try_s:
print("OK")
p = Pin("LED1", Pin.OUT)
p.high()
if p.value() == 1:
print("pass")
else:
print("NG")
print("exp: " + try_s)
print("out: " + str(p))

p.init(p.IN, p.PULL_UP)
p.init(p.IN, pull=p.PULL_UP)
p.init(mode=p.IN, pull=p.PULL_UP)
print(p.value())

p.init(p.OUT)
p.init(p.OPEN_DRAIN)
print("FAIL")
p.low()
print(p.value())
p.high()
print(p.value())
p.value(0)
print(p.value())
p.value(1)
print(p.value())
p.value(False)
print(p.value())
p.value(True)
print(p.value())
p.off()
print(p.value())
p.on()
print(p.value())
p.off()
12 changes: 2 additions & 10 deletions tests/renesas-ra/pin.py.exp
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
OK
1
0
1
0
1
0
1
0
1
pass
pass

0 comments on commit 2f2fd36

Please sign in to comment.