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 customise the filesystem configuration or implement a low-level storage system for your application.
- 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
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).
- Flash.readblocks(block_num, buf)¶
- Flash.readblocks(block_num, buf, offset)
- Flash.writeblocks(block_num, buf)¶
- Flash.writeblocks(block_num, buf, offset)
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 MCU will be used.