diff options
| author | Damien George <damien@micropython.org> | 2024-02-02 13:51:18 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-02-07 13:25:10 +1100 |
| commit | 4c56b39051b4a992d8691aa504cd2e76b958bf26 (patch) | |
| tree | 9bd5e19a08626bf26c222c3e093e65916ce147b0 /docs/mimxrt | |
| parent | 7d28789544e4e35d8c931b41765dd64a53c506f1 (diff) | |
docs: Use vfs module instead of os.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'docs/mimxrt')
| -rw-r--r-- | docs/mimxrt/quickref.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/mimxrt/quickref.rst b/docs/mimxrt/quickref.rst index 578364c55..519313438 100644 --- a/docs/mimxrt/quickref.rst +++ b/docs/mimxrt/quickref.rst @@ -443,27 +443,27 @@ SD card See :ref:`machine.SDCard <machine.SDCard>`:: - import machine, os + import machine, os, vfs sd = machine.SDCard() - fs = os.VfsFat(sd) - os.mount(fs, "/sd") # mount + fs = vfs.VfsFat(sd) + vfs.mount(fs, "/sd") # mount os.listdir('/sd') # list directory contents - os.umount('/sd') # eject + vfs.umount('/sd') # eject Note: The i.mx-rt 1011 and 1015 based boards do not support the ``machine.SDCard`` class. For these, the SPI based driver ``sdcard.py`` from the MicroPython drivers can be used. When using it, you have to overdrive the CS pin of the SPI hardware module. Example:: - import os, sdcard, machine + import vfs, sdcard, machine cs_pin = "D10" spi = machine.SPI(0) # SPI0 with cs at Pin "D10" used for SDCARD cs = machine.Pin(cs_pin, machine.Pin.OUT, value=1) sd = sdcard.SDCard(spi, cs) - vfs = os.VfsFat(sd) - os.mount(vfs, "/sdcard") + fs = vfs.VfsFat(sd) + vfs.mount(fs, "/sdcard") OneWire driver -------------- |
