diff options
Diffstat (limited to 'docs/zephyr/quickref.rst')
| -rw-r--r-- | docs/zephyr/quickref.rst | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/zephyr/quickref.rst b/docs/zephyr/quickref.rst index 6025092a0..78d465050 100644 --- a/docs/zephyr/quickref.rst +++ b/docs/zephyr/quickref.rst @@ -135,11 +135,14 @@ the ``io-channels`` property containing all the ADC channels):: Disk Access ----------- -Use the :ref:`zephyr.DiskAccess <zephyr.DiskAccess>` class to support filesystem:: +Storage devices such as SD cards are automatically mounted at startup (e.g., at ``/sd``). +For manual mounting, use the :ref:`zephyr.DiskAccess <zephyr.DiskAccess>` class:: import vfs from zephyr import DiskAccess + print(DiskAccess.disks) # list available disk names, e.g., ('SDHC',) + block_dev = DiskAccess('SDHC') # create a block device object for an SD card vfs.VfsFat.mkfs(block_dev) # create FAT filesystem object using the disk storage block vfs.mount(block_dev, '/sd') # mount the filesystem at the SD card subdirectory @@ -152,12 +155,15 @@ Use the :ref:`zephyr.DiskAccess <zephyr.DiskAccess>` class to support filesystem Flash Area ---------- -Use the :ref:`zephyr.FlashArea <zephyr.FlashArea>` class to support filesystem:: +Flash storage is automatically mounted at ``/flash`` at startup with automatic filesystem creation. +For manual mounting, use the :ref:`zephyr.FlashArea <zephyr.FlashArea>` class:: import vfs from zephyr import FlashArea - block_dev = FlashArea(4, 4096) # creates a block device object in the frdm-k64f flash scratch partition + print(FlashArea.areas) # list available areas, e.g., {'storage': 1, 'scratch': 4} + + block_dev = FlashArea(FlashArea.areas['scratch'], 4096) # creates a block device object using the scratch partition vfs.VfsLfs2.mkfs(block_dev) # create filesystem in lfs2 format using the flash block device vfs.mount(block_dev, '/flash') # mount the filesystem at the flash subdirectory @@ -166,8 +172,6 @@ Use the :ref:`zephyr.FlashArea <zephyr.FlashArea>` class to support filesystem:: f.write('Hello world') # write to the file print(open('/flash/hello.txt').read()) # print contents of the file -The ``FlashAreas``' IDs that are available are listed in the FlashArea module, as ``ID_*``. - Sensor ------ |
