diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2019-12-04 13:50:51 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-12-04 23:18:17 +1100 |
commit | f2650be844d73b09b990ec2c0328e0262bb99442 (patch) | |
tree | 732f617a835918a59f5ea2fc9baa44c0e74d703c | |
parent | d7dbd267e73bf745e985da9155490b5358cb874a (diff) | |
download | micropython-f2650be844d73b09b990ec2c0328e0262bb99442.tar.gz micropython-f2650be844d73b09b990ec2c0328e0262bb99442.zip |
docs/library: Add docs for pyb.Flash class.
-rw-r--r-- | docs/library/pyb.Flash.rst | 52 | ||||
-rw-r--r-- | docs/library/pyb.rst | 1 |
2 files changed, 53 insertions, 0 deletions
diff --git a/docs/library/pyb.Flash.rst b/docs/library/pyb.Flash.rst new file mode 100644 index 0000000000..2d2f83da1c --- /dev/null +++ b/docs/library/pyb.Flash.rst @@ -0,0 +1,52 @@ +.. currentmodule:: pyb +.. _pyb.Flash: + +class Flash -- access to built-in flash storage +=============================================== + +The Flash class allows direct access to the primary flash device on the pyboard. + +In most cases, to store persistent data on the device, you'll want to use a +higher-level abstraction, for example the filesystem via Python's standard file +API, but this interface is useful to :ref:`customise the filesystem +configuration <filesystem>` or implement a low-level storage system for your +application. + +Constructors +------------ + +.. class:: pyb.Flash() + + Create and return a block device that represents the flash device presented + to the USB mass storage interface. + + It includes a virtual partition table at the start, and the actual flash + starts at block ``0x100``. + + This constructor is deprecated and will be removed in a future version of MicroPython. + +.. class:: pyb.Flash(\*, start=-1, len=-1) + + Create and return a block device that accesses the flash at the specified offset. The length defaults to the remaining size of the device. + + The *start* and *len* offsets are in bytes, and must be a multiple of the block size (typically 512 for internal flash). + +Methods +------- + +.. method:: Flash.readblocks(block_num, buf) +.. method:: Flash.readblocks(block_num, buf, offset) +.. method:: Flash.writeblocks(block_num, buf) +.. method:: Flash.writeblocks(block_num, buf, offset) +.. method:: Flash.ioctl(cmd, arg) + + These methods implement the simple and :ref:`extended + <block-device-interface>` block protocol defined by + :class:`uos.AbstractBlockDev`. + +Hardware Note +------------- + +On boards with external spiflash (e.g. Pyboard D), the MicroPython firmware will +be configured to use that as the primary flash storage. On all other boards, the +internal flash inside the :term:`MCU` will be used. diff --git a/docs/library/pyb.rst b/docs/library/pyb.rst index 714207ba15..34103195dd 100644 --- a/docs/library/pyb.rst +++ b/docs/library/pyb.rst @@ -309,6 +309,7 @@ Classes pyb.CAN.rst pyb.DAC.rst pyb.ExtInt.rst + pyb.Flash.rst pyb.I2C.rst pyb.LCD.rst pyb.LED.rst |