changeset 1:4b538731a207 default tip

Add a readme
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Mon, 22 Aug 2016 12:14:43 +0200
parents 765d0ffbb57b
children
files README.rst sdcard.py
diffstat 2 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.rst	Mon Aug 22 12:14:43 2016 +0200
@@ -0,0 +1,29 @@
+SD Card driver for ESP8266 MicroPython
+**************************************
+
+Since MicroPython on the ESP8266 doesn't let you have multiple filesystems
+at the moment, you can only replace the internal filesystem with the one on
+the sd card. In order to do that, you need to compile your own firmware.
+
+Edit your ``esp8266/modules/_boot.py`` and replace the mounting of the filesystem::
+
+    import gc
+    gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4)
+    import uos
+    # from flashbdev import bdev
+    #
+    #try:
+    #    if bdev:
+    #        vfs = uos.VfsFat(bdev, "")
+    #except OSError:
+    #    import inisetup
+    #    vfs = inisetup.setup()
+
+    import sdcard
+    sdcard.esp8266_mount()
+
+    gc.collect()
+
+Then add the ``sdcard.py`` file from this repository to ``esp8266/modules``.
+Connect your SD Card socket to your ESP8266 board's SPI (``miso=Pin(12),
+mosi=Pin(13), sck=Pin(14), cs=Pin(15)``), and enjoy!
--- a/sdcard.py	Mon Aug 22 11:55:12 2016 +0200
+++ b/sdcard.py	Mon Aug 22 12:14:43 2016 +0200
@@ -259,4 +259,4 @@
     import uos
     spi = SPI(-1, miso=Pin(12), mosi=Pin(13), sck=Pin(14))
     sd = sdcard.SDCard(spi, Pin(15))
-    uos.VfsFat(sd, "")
+    return uos.VfsFat(sd, "")