2017-06-06 16:17:35 -04:00
|
|
|
"""
|
|
|
|
|
|
|
|
Example for pca10040 / nrf52832 to show how mount
|
|
|
|
and list a sdcard connected over SPI.
|
|
|
|
|
|
|
|
|
|
|
|
Direct wireing on SD card (SPI):
|
|
|
|
______________________________
|
|
|
|
| \
|
|
|
|
| 9. | NC | \
|
|
|
|
| 1. | ~CS | |
|
|
|
|
| 2. | MOSI | |
|
|
|
|
| 3. | GND | |
|
|
|
|
| 4. | VCC3.3| |
|
|
|
|
| 5. | SCK | |
|
|
|
|
| 6. | GND | |
|
|
|
|
| 7. | MISO | |
|
|
|
|
| 8. | NC | |
|
|
|
|
| |
|
|
|
|
---------------------------------
|
|
|
|
"""
|
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
import os
|
2016-12-27 09:42:35 -05:00
|
|
|
from machine import SPI, Pin
|
2016-12-13 14:27:26 -05:00
|
|
|
from sdcard import SDCard
|
|
|
|
|
2017-06-06 16:17:35 -04:00
|
|
|
def mnt():
|
|
|
|
cs = Pin("A22", mode=Pin.OUT)
|
|
|
|
sd = SDCard(SPI(0), cs)
|
2016-12-13 14:27:26 -05:00
|
|
|
os.mount(sd, '/')
|
|
|
|
|
2017-06-06 16:17:35 -04:00
|
|
|
def list():
|
|
|
|
files = os.listdir()
|
|
|
|
print(files)
|
|
|
|
|