From 391cb3ebe8aa7f0dbbfecf56f47598086ce6b565 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Tue, 6 Jun 2017 22:17:35 +0200 Subject: [PATCH] nrf5/examples: Updating mountsd example with comment from deleted sdcard.py on how to wire SD directly to SPI. --- nrf5/examples/mountsd.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/nrf5/examples/mountsd.py b/nrf5/examples/mountsd.py index e449a692dc..1577221a62 100644 --- a/nrf5/examples/mountsd.py +++ b/nrf5/examples/mountsd.py @@ -1,8 +1,35 @@ +""" + +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 | | + | | + --------------------------------- +""" + import os from machine import SPI, Pin from sdcard import SDCard -def mount_sd(): - sd = SDCard(SPI(0), Pin("A22", mode=Pin.OUT)) +def mnt(): + cs = Pin("A22", mode=Pin.OUT) + sd = SDCard(SPI(0), cs) os.mount(sd, '/') +def list(): + files = os.listdir() + print(files) +