circuitpython/ports/rp2/modules/_boot_fat.py

16 lines
275 B
Python

import os
import machine, rp2
# Try to mount the filesystem, and format the flash if it doesn't exist.
bdev = rp2.Flash()
try:
vfs = os.VfsFat(bdev)
os.mount(vfs, "/")
except:
os.VfsFat.mkfs(bdev)
vfs = os.VfsFat(bdev)
os.mount(vfs, "/")
del os, bdev, vfs