tests/renesas-ra: Update pin test to support all boards.

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
This commit is contained in:
Takeo Takahashi 2022-06-23 22:28:35 +09:00 committed by Damien George
parent 621bff8557
commit 2f2fd36713
2 changed files with 12 additions and 48 deletions

View File

@ -1,43 +1,15 @@
from machine import Pin from machine import Pin
import os
n = os.uname().machine p = Pin("SW1", Pin.IN)
if "RA4W1_EK" in n: if p.value() == 1:
try_pin = "P004" print("pass")
try_s = "Pin(Pin.cpu.P004, mode=Pin.IN, pull=Pin.PULL_NONE, drive=Pin.LOW_POWER)"
else: else:
try_pin = "P000" print("FAIL")
try_s = "Pin(Pin.cpu.P000, mode=Pin.IN, pull=Pin.PULL_NONE, drive=Pin.LOW_POWER)"
p = Pin(try_pin, Pin.IN) p = Pin("LED1", Pin.OUT)
if str(p) == try_s:
print("OK")
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)
p.low()
print(p.value())
p.high() p.high()
print(p.value()) if p.value() == 1:
p.value(0) print("pass")
print(p.value()) else:
p.value(1) print("FAIL")
print(p.value()) p.low()
p.value(False)
print(p.value())
p.value(True)
print(p.value())
p.off()
print(p.value())
p.on()
print(p.value())
p.off()

View File

@ -1,10 +1,2 @@
OK pass
1 pass
0
1
0
1
0
1
0
1