summaryrefslogtreecommitdiff
path: root/tests/pyb/adc.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-02-06 13:48:01 +1100
committerDamien George <damien.p.george@gmail.com>2017-02-06 13:50:34 +1100
commitd3bb3e38df3fcb2b980d37e06fde7eac9e689f6a (patch)
treec40a640ef34bceddc2d1aac602717b23f58d2196 /tests/pyb/adc.py
parent27c149efe030b6fd24c0cc1475ea509da1a72821 (diff)
tests/pyb: Adjust tests so they can run on PYB and PYBLITE.
A few tests still fail on PYBLITE, and that's due to differences in the available peripheral block numbers on the different MCUs (eg I2C(2) exists on one, but it's I2C(3) on the other).
Diffstat (limited to 'tests/pyb/adc.py')
-rw-r--r--tests/pyb/adc.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/pyb/adc.py b/tests/pyb/adc.py
index 6508d7e24..362ca326d 100644
--- a/tests/pyb/adc.py
+++ b/tests/pyb/adc.py
@@ -9,9 +9,12 @@ print(adc)
val = adc.read()
assert val < 500
+# timer for read_timed
+tim = pyb.Timer(5, freq=500)
+
# read into bytearray
buf = bytearray(50)
-adc.read_timed(buf, 500)
+adc.read_timed(buf, tim)
print(len(buf))
for i in buf:
assert i < 500
@@ -19,12 +22,12 @@ for i in buf:
# read into arrays with different element sizes
import array
ar = array.array('h', 25 * [0])
-adc.read_timed(ar, 500)
+adc.read_timed(ar, tim)
print(len(ar))
for i in buf:
assert i < 500
ar = array.array('i', 30 * [0])
-adc.read_timed(ar, 500)
+adc.read_timed(ar, tim)
print(len(ar))
for i in buf:
assert i < 500