Skip to content

Commit 526dd54

Browse files
committed
tests: Add test for pyboard SPI in slave mode, recv with no master.
See PR adafruit#1414.
1 parent 8a1a5c2 commit 526dd54

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

tests/pyb/spi.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919
spi.init(SPI.SLAVE, phase=1)
2020
print(spi)
21+
try:
22+
# need to flush input before we get an error (error is what we want to test)
23+
for i in range(10):
24+
spi.recv(1, timeout=100)
25+
except OSError:
26+
print("OSError")
2127

2228
spi.init(SPI.MASTER)
2329
spi.send(1, timeout=100)

tests/pyb/spi.py.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ ValueError Z
99
SPI(1)
1010
SPI(1, SPI.MASTER, baudrate=328125, prescaler=256, polarity=1, phase=0, bits=8)
1111
SPI(1, SPI.SLAVE, polarity=1, phase=1, bits=8)
12+
OSError
1213
b'\xff'
1314
b'\xff'

0 commit comments

Comments
 (0)