summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-08-05 23:44:25 +0100
committerDamien George <damien.p.george@gmail.com>2015-08-05 23:47:57 +0100
commit526dd542528c681c81558ba8395759e891cdecf2 (patch)
tree5432b0b7ac73204ee3b72b150d31c9c9b5274607
parent8a1a5c236d1fc07596a1f23f73e26f24c0e5b540 (diff)
downloadmicropython-526dd542528c681c81558ba8395759e891cdecf2.tar.gz
micropython-526dd542528c681c81558ba8395759e891cdecf2.zip
tests: Add test for pyboard SPI in slave mode, recv with no master.
See PR #1414.
-rw-r--r--tests/pyb/spi.py6
-rw-r--r--tests/pyb/spi.py.exp1
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/pyb/spi.py b/tests/pyb/spi.py
index 16b51e7e44..b7a905d78c 100644
--- a/tests/pyb/spi.py
+++ b/tests/pyb/spi.py
@@ -18,6 +18,12 @@ print(spi)
spi.init(SPI.SLAVE, phase=1)
print(spi)
+try:
+ # need to flush input before we get an error (error is what we want to test)
+ for i in range(10):
+ spi.recv(1, timeout=100)
+except OSError:
+ print("OSError")
spi.init(SPI.MASTER)
spi.send(1, timeout=100)
diff --git a/tests/pyb/spi.py.exp b/tests/pyb/spi.py.exp
index 9a87b351b8..a0d835700f 100644
--- a/tests/pyb/spi.py.exp
+++ b/tests/pyb/spi.py.exp
@@ -9,5 +9,6 @@ ValueError Z
SPI(1)
SPI(1, SPI.MASTER, baudrate=328125, prescaler=256, polarity=1, phase=0, bits=8)
SPI(1, SPI.SLAVE, polarity=1, phase=1, bits=8)
+OSError
b'\xff'
b'\xff'