drivers/sdcard: In test use os.umount and machine module instead of pyb.

pyb.umount(None, mountpoint) no longer works.
This commit is contained in:
Peter Hinch 2018-09-16 11:25:32 +01:00 committed by Damien George
parent 6623d7a88c
commit 1628cd0e59

View File

@ -1,10 +1,13 @@
# Test for sdcard block protocol
# Peter hinch 30th Jan 2016
import os, sdcard, pyb
import os, sdcard, machine
def sdtest():
sd = sdcard.SDCard(pyb.SPI(1), pyb.Pin.board.X21) # Compatible with PCB
pyb.mount(sd, '/fc')
spi = machine.SPI(1)
spi.init() # Ensure right baudrate
sd = sdcard.SDCard(spi, machine.Pin.board.X21) # Compatible with PCB
vfs = os.VfsFat(sd)
os.mount(vfs, '/fc')
print('Filesystem check')
print(os.listdir('/fc'))
@ -38,7 +41,7 @@ def sdtest():
result2 = f.read()
print(len(result2), 'bytes read')
pyb.mount(None, '/fc')
os.umount('/fc')
print()
print('Verifying data read back')