summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-05-02 15:25:37 +1000
committerDamien George <damien.p.george@gmail.com>2018-05-02 15:25:37 +1000
commitdb2bdad8a2ed0814a64d0859fa6ea435a110d304 (patch)
treeb39340db25e2f248de545cc71228b1841df2f8d1
parent051686b0a84ac78219c3509fda2a81dd89f3428a (diff)
tests/pyb: Update tests to run correctly on PYBv1.0.
In adcall.py the pyb module may not be imported, so use ADCAll directly. In dac.py the DAC object now prints more info, so update .exp file. In spi.py the SPI should be deinitialised upon exit, so the test can run a second time correctly.
-rw-r--r--tests/pyb/adcall.py6
-rw-r--r--tests/pyb/dac.py.exp2
-rw-r--r--tests/pyb/spi.py2
3 files changed, 6 insertions, 4 deletions
diff --git a/tests/pyb/adcall.py b/tests/pyb/adcall.py
index afc3033ea..cfe179a97 100644
--- a/tests/pyb/adcall.py
+++ b/tests/pyb/adcall.py
@@ -5,19 +5,19 @@ pins = [Pin.cpu.A0, Pin.cpu.A1, Pin.cpu.A2, Pin.cpu.A3]
# set pins to IN mode, init ADCAll, then check pins are ANALOG
for p in pins:
p.init(p.IN)
-adc = pyb.ADCAll(12)
+adc = ADCAll(12)
for p in pins:
print(p)
# set pins to IN mode, init ADCAll with mask, then check some pins are ANALOG
for p in pins:
p.init(p.IN)
-adc = pyb.ADCAll(12, 0x70003)
+adc = ADCAll(12, 0x70003)
for p in pins:
print(p)
# init all pins to ANALOG
-adc = pyb.ADCAll(12)
+adc = ADCAll(12)
print(adc)
# read all channels
diff --git a/tests/pyb/dac.py.exp b/tests/pyb/dac.py.exp
index ae245f2e6..7ee99652a 100644
--- a/tests/pyb/dac.py.exp
+++ b/tests/pyb/dac.py.exp
@@ -1 +1 @@
-<DAC>
+DAC(1, bits=8)
diff --git a/tests/pyb/spi.py b/tests/pyb/spi.py
index b7a905d78..88cc975bb 100644
--- a/tests/pyb/spi.py
+++ b/tests/pyb/spi.py
@@ -29,3 +29,5 @@ spi.init(SPI.MASTER)
spi.send(1, timeout=100)
print(spi.recv(1, timeout=100))
print(spi.send_recv(1, timeout=100))
+
+spi.deinit()