summaryrefslogtreecommitdiff
path: root/drivers/sdcard/sdtest.py
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-02-21 20:14:46 -0500
committerGitHub <noreply@github.com>2018-02-21 20:14:46 -0500
commit419920987c2e9473ec7b75064506b9acbb696ddd (patch)
tree758b72f0948e9894d4de03fe967e727da34038bc /drivers/sdcard/sdtest.py
parentee90056866d2a8a1e0eec21f0ce5c60b741ea411 (diff)
parente667bdfe0583909c1a6fd7789ab5605f010d3005 (diff)
Merge pull request #632 from tannewt/delete_out_of_date
Delete out of date docs, drivers and examples
Diffstat (limited to 'drivers/sdcard/sdtest.py')
-rw-r--r--drivers/sdcard/sdtest.py57
1 files changed, 0 insertions, 57 deletions
diff --git a/drivers/sdcard/sdtest.py b/drivers/sdcard/sdtest.py
deleted file mode 100644
index 438baa245..000000000
--- a/drivers/sdcard/sdtest.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# Test for sdcard block protocol
-# Peter hinch 30th Jan 2016
-import os, sdcard, pyb
-
-def sdtest():
- sd = sdcard.SDCard(pyb.SPI(1), pyb.Pin.board.X21) # Compatible with PCB
- pyb.mount(sd, '/fc')
- print('Filesystem check')
- print(os.listdir('/fc'))
-
- line = 'abcdefghijklmnopqrstuvwxyz\n'
- lines = line * 200 # 5400 chars
- short = '1234567890\n'
-
- fn = '/fc/rats.txt'
- print()
- print('Multiple block read/write')
- with open(fn,'w') as f:
- n = f.write(lines)
- print(n, 'bytes written')
- n = f.write(short)
- print(n, 'bytes written')
- n = f.write(lines)
- print(n, 'bytes written')
-
- with open(fn,'r') as f:
- result1 = f.read()
- print(len(result1), 'bytes read')
-
- fn = '/fc/rats1.txt'
- print()
- print('Single block read/write')
- with open(fn,'w') as f:
- n = f.write(short) # one block
- print(n, 'bytes written')
-
- with open(fn,'r') as f:
- result2 = f.read()
- print(len(result2), 'bytes read')
-
- pyb.mount(None, '/fc')
-
- print()
- print('Verifying data read back')
- success = True
- if result1 == ''.join((lines, short, lines)):
- print('Large file Pass')
- else:
- print('Large file Fail')
- success = False
- if result2 == short:
- print('Small file Pass')
- else:
- print('Small file Fail')
- success = False
- print()
- print('Tests', 'passed' if success else 'failed')