tests: Add test for pyboard SPI in slave mode, recv with no master.

See PR #1414.
This commit is contained in:
Damien George 2015-08-05 23:44:25 +01:00
parent 8a1a5c236d
commit 526dd54252
2 changed files with 7 additions and 0 deletions

View file

@ -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)

View file

@ -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'