summaryrefslogtreecommitdiff
path: root/drivers/sdcard/sdtest.py
diff options
context:
space:
mode:
authorPeter Hinch <peter@hinch.me.uk>2018-09-16 11:25:32 +0100
committerDamien George <damien.p.george@gmail.com>2018-09-20 16:09:28 +1000
commit1628cd0e5920c52564e443d067d404b88704bd29 (patch)
tree5f193e1106059d0471f914739cc631bbd94389cb /drivers/sdcard/sdtest.py
parent6623d7a88c0eb3e8b7bf85b2eb7bef5ea6350bfd (diff)
drivers/sdcard: In test use os.umount and machine module instead of pyb.
pyb.umount(None, mountpoint) no longer works.
Diffstat (limited to 'drivers/sdcard/sdtest.py')
-rw-r--r--drivers/sdcard/sdtest.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/sdcard/sdtest.py b/drivers/sdcard/sdtest.py
index 438baa245..01fe65aa9 100644
--- a/drivers/sdcard/sdtest.py
+++ b/drivers/sdcard/sdtest.py
@@ -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')